{"action":"created","issue":{"url":"https://api.github.com/repos/grafana/grafana/issues/4055","repository_url":"https://api.github.com/repos/grafana/grafana","labels_url":"https://api.github.com/repos/grafana/grafana/issues/4055/labels{/name}","comments_url":"https://api.github.com/repos/grafana/grafana/issues/4055/comments","events_url":"https://api.github.com/repos/grafana/grafana/issues/4055/events","html_url":"https://github.com/grafana/grafana/issues/4055","id":134190755,"number":4055,"title":"issues with logging library","user":{"login":"Dieterbe","id":20774,"avatar_url":"https://avatars.githubusercontent.com/u/20774?v=3","gravatar_id":"","url":"https://api.github.com/users/Dieterbe","html_url":"https://github.com/Dieterbe","followers_url":"https://api.github.com/users/Dieterbe/followers","following_url":"https://api.github.com/users/Dieterbe/following{/other_user}","gists_url":"https://api.github.com/users/Dieterbe/gists{/gist_id}","starred_url":"https://api.github.com/users/Dieterbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dieterbe/subscriptions","organizations_url":"https://api.github.com/users/Dieterbe/orgs","repos_url":"https://api.github.com/users/Dieterbe/repos","events_url":"https://api.github.com/users/Dieterbe/events{/privacy}","received_events_url":"https://api.github.com/users/Dieterbe/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-17T06:24:39Z","updated_at":"2016-02-17T06:59:34Z","closed_at":"2016-02-17T06:59:34Z","body":"Here's some things i noticed about the logging library\r\n\r\n* what's with the adapter registration stuff? why is there a need for the \"adapters\" datastructure? instead of having people do like `log.NewLogger(0, \"console\", config)` you could just do `log.NewLogger, 0, log.NewConsole(config))`. the compiler is a pretty good system for assuring you don't have two identically named functions and that the code doesn't call functions which don't exist. So all this checking for proper adapter strings, \"called register twice\" checks, is not needed if people can just call the constructors directly. \r\n\r\n* why the separate Init step, why not just pass in the config when creating the object?\r\n\r\n* why does the API use json config data? it's ironic that grafana has to parse the grafana config file, \r\nthen generate a json config, pass that to the log lib, and have the log lib parse the json and return errors at runtime.  Using actual parameters or structs would be much more robust (and fast). The compiler can do static compile time checks for your config (from the log lib's API perspective at least), and you can easily reference the actual levels instead of having to specify numbers.\r\n\r\n* creating a new logger is very misleading and performs needlessly poorly.  I.e. in metric_tank, which uses this lib, we do:\r\n```\r\n\tlog.NewLogger(0, \"console\", fmt.Sprintf(`{\"level\": %d, \"formatting\":true}`, *logLevel))\r\n```\r\n\r\nwhat this actually does, is create a new logger (with no control over settings such as loglevel), and the \"console logger\" is just an \"output\" for said auto-created logger. not only does this seem like a needless overcomplication, it will cause needless work. e.g. on `Debug()` calls some allocation work, then call writerMsg (more allocations and various work), then a channel write and channel read, only then to just send the message to the one output's WriteMsg, only at this point do we hit the thing we configured, the \"output\" which can decide to discard the message based on the level. needless to say performance features like  https://github.com/grafana/grafana/commit/bd2e9a86d14a6f57411b6d32b8800133622fe9b8 don't work in this scenario. am I doing something wrong?  I've been looking for a way to set the level on the actual \"logger\" then but there doesn't seem to be a facility for this at all."},"comment":{"url":"https://api.github.com/repos/grafana/grafana/issues/comments/185061101","html_url":"https://github.com/grafana/grafana/issues/4055#issuecomment-185061101","issue_url":"https://api.github.com/repos/grafana/grafana/issues/4055","id":185061101,"user":{"login":"torkelo","id":10999,"avatar_url":"https://avatars.githubusercontent.com/u/10999?v=3","gravatar_id":"","url":"https://api.github.com/users/torkelo","html_url":"https://github.com/torkelo","followers_url":"https://api.github.com/users/torkelo/followers","following_url":"https://api.github.com/users/torkelo/following{/other_user}","gists_url":"https://api.github.com/users/torkelo/gists{/gist_id}","starred_url":"https://api.github.com/users/torkelo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torkelo/subscriptions","organizations_url":"https://api.github.com/users/torkelo/orgs","repos_url":"https://api.github.com/users/torkelo/repos","events_url":"https://api.github.com/users/torkelo/events{/privacy}","received_events_url":"https://api.github.com/users/torkelo/received_events","type":"User","site_admin":false},"created_at":"2016-02-17T06:59:34Z","updated_at":"2016-02-17T06:59:34Z","body":"oh regarding the json config, yea, find that strange as well. "}}