Logging function & Better undefined handling

Added a boolean to the config to enable/disable logging & handled the
fact that the resource may not have been loaded when filtering for keys
Added an example use of the localisation module