{"action":"created","issue":{"url":"https://api.github.com/repos/zatonovo/futile.logger/issues/35","repository_url":"https://api.github.com/repos/zatonovo/futile.logger","labels_url":"https://api.github.com/repos/zatonovo/futile.logger/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/zatonovo/futile.logger/issues/35/comments","events_url":"https://api.github.com/repos/zatonovo/futile.logger/issues/35/events","html_url":"https://github.com/zatonovo/futile.logger/pull/35","id":161592975,"number":35,"title":"Function name and namepsace detection","user":{"login":"fnoorian","id":7859471,"avatar_url":"https://avatars.githubusercontent.com/u/7859471?v=3","gravatar_id":"","url":"https://api.github.com/users/fnoorian","html_url":"https://github.com/fnoorian","followers_url":"https://api.github.com/users/fnoorian/followers","following_url":"https://api.github.com/users/fnoorian/following{/other_user}","gists_url":"https://api.github.com/users/fnoorian/gists{/gist_id}","starred_url":"https://api.github.com/users/fnoorian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fnoorian/subscriptions","organizations_url":"https://api.github.com/users/fnoorian/orgs","repos_url":"https://api.github.com/users/fnoorian/repos","events_url":"https://api.github.com/users/fnoorian/events{/privacy}","received_events_url":"https://api.github.com/users/fnoorian/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-06-22T04:46:36Z","updated_at":"2016-07-10T13:49:54Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/zatonovo/futile.logger/pulls/35","html_url":"https://github.com/zatonovo/futile.logger/pull/35","diff_url":"https://github.com/zatonovo/futile.logger/pull/35.diff","patch_url":"https://github.com/zatonovo/futile.logger/pull/35.patch"},"body":"Not sure if this is a bug or by design, but here is a solution (or alternative if this is by design).\r\n\r\nWhen detecting namespace or function name, `flog.namespace` uses the first element on the call stack, which is usually irrelevant to the function calling the `flog.xxx` series.\r\n\r\nFor example,\r\n```R\r\nlibrary(futile.logger)\r\n\r\nflog.layout(layout.format(\"[~f] ~m\"))\r\na_caller <- function() { flog.info(\"inside A\") }\r\nb <- function() { a_caller() }\r\nd <- function() { b() }\r\ne <- function() { d() }\r\n\r\ne()\r\n```\r\nprints\r\n```\r\nR> [e] inside A\r\n```\r\nwhile one expects\r\n```\r\nR> [a_caller] inside A\r\n```\r\n\r\nA similar thing happens for the namespaces (the `[~n]`) specially inside packages.\r\n\r\nIn the pull request, flog.namespace was changed to find the correct function from the other side of the call stack.\r\n"},"comment":{"url":"https://api.github.com/repos/zatonovo/futile.logger/issues/comments/231589987","html_url":"https://github.com/zatonovo/futile.logger/pull/35#issuecomment-231589987","issue_url":"https://api.github.com/repos/zatonovo/futile.logger/issues/35","id":231589987,"user":{"login":"muxspace","id":581414,"avatar_url":"https://avatars.githubusercontent.com/u/581414?v=3","gravatar_id":"","url":"https://api.github.com/users/muxspace","html_url":"https://github.com/muxspace","followers_url":"https://api.github.com/users/muxspace/followers","following_url":"https://api.github.com/users/muxspace/following{/other_user}","gists_url":"https://api.github.com/users/muxspace/gists{/gist_id}","starred_url":"https://api.github.com/users/muxspace/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muxspace/subscriptions","organizations_url":"https://api.github.com/users/muxspace/orgs","repos_url":"https://api.github.com/users/muxspace/repos","events_url":"https://api.github.com/users/muxspace/events{/privacy}","received_events_url":"https://api.github.com/users/muxspace/received_events","type":"User","site_admin":false},"created_at":"2016-07-10T13:49:54Z","updated_at":"2016-07-10T13:49:54Z","body":"Awesome, thanks for fixing this!"}}
{"actor":{"display_login":"muxspace"}}