{"action":"closed","issue":{"url":"https://api.github.com/repos/freedomjs/freedom/issues/196","labels_url":"https://api.github.com/repos/freedomjs/freedom/issues/196/labels{/name}","comments_url":"https://api.github.com/repos/freedomjs/freedom/issues/196/comments","events_url":"https://api.github.com/repos/freedomjs/freedom/issues/196/events","html_url":"https://github.com/freedomjs/freedom/issues/196","id":54677419,"number":196,"title":"Allow synchronous creation of loggers","user":{"login":"iislucas","id":415450,"avatar_url":"https://avatars.githubusercontent.com/u/415450?v=3","gravatar_id":"","url":"https://api.github.com/users/iislucas","html_url":"https://github.com/iislucas","followers_url":"https://api.github.com/users/iislucas/followers","following_url":"https://api.github.com/users/iislucas/following{/other_user}","gists_url":"https://api.github.com/users/iislucas/gists{/gist_id}","starred_url":"https://api.github.com/users/iislucas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iislucas/subscriptions","organizations_url":"https://api.github.com/users/iislucas/orgs","repos_url":"https://api.github.com/users/iislucas/repos","events_url":"https://api.github.com/users/iislucas/events{/privacy}","received_events_url":"https://api.github.com/users/iislucas/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/freedomjs/freedom/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-17T22:14:51Z","updated_at":"2015-04-23T18:25:41Z","closed_at":"2015-04-23T18:25:41Z","body":"At the moment (freedom 0.6), to get a logger, you have to do something like this: \r\n```\r\nvar logger;\r\n// Create a logger for this module.\r\nfreedom.core().getLogger('[MyModule]').then(function (log) {\r\n  logger = log;\r\n  logger.log('MyModule Logger Instantiated');\r\n});\r\n\r\n// ... \r\n// Note: logger.warn must only be called after the `freedom.core().getLogger`\r\n// promise has resolved, otherwise `logger` will be undefined. \r\n  logger.warn(msg);\r\n```\r\n\r\nAs well as being a little inconvenient, the core logging provider is not available when a module's main JS code gets executed.\r\n\r\nIt would be better if logging was provided synchronously instead of asynchronously. \r\n\r\ne.g. the above should be writable as: \r\n\r\n```\r\nlogger = freedom.makeLogger('[MyModule]');\r\nlogger.log('blah blah blah');\r\n```\r\n\r\nI think this can be done by a simple buffering layer that does the promise work for you in the module environment provided by freedom. "}}