{"action":"created","issue":{"url":"https://api.github.com/repos/mirage/mirage/issues/514","repository_url":"https://api.github.com/repos/mirage/mirage","labels_url":"https://api.github.com/repos/mirage/mirage/issues/514/labels{/name}","comments_url":"https://api.github.com/repos/mirage/mirage/issues/514/comments","events_url":"https://api.github.com/repos/mirage/mirage/issues/514/events","html_url":"https://github.com/mirage/mirage/pull/514","id":140647095,"number":514,"title":"[POC] Support early configuration of logging","user":{"login":"talex5","id":554131,"avatar_url":"https://avatars.githubusercontent.com/u/554131?v=3","gravatar_id":"","url":"https://api.github.com/users/talex5","html_url":"https://github.com/talex5","followers_url":"https://api.github.com/users/talex5/followers","following_url":"https://api.github.com/users/talex5/following{/other_user}","gists_url":"https://api.github.com/users/talex5/gists{/gist_id}","starred_url":"https://api.github.com/users/talex5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/talex5/subscriptions","organizations_url":"https://api.github.com/users/talex5/orgs","repos_url":"https://api.github.com/users/talex5/repos","events_url":"https://api.github.com/users/talex5/events{/privacy}","received_events_url":"https://api.github.com/users/talex5/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-14T11:27:31Z","updated_at":"2016-03-14T12:15:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mirage/mirage/pulls/514","html_url":"https://github.com/mirage/mirage/pull/514","diff_url":"https://github.com/mirage/mirage/pull/514.diff","patch_url":"https://github.com/mirage/mirage/pull/514.patch"},"body":"To get logging, wrap your job with `mirage_logs`, like this:\r\n\r\n    open Mirage\r\n\r\n    let handler = foreign\r\n      \"Unikernel.Main\" (stackv4 @-> job)\r\n\r\n    let stack = generic_stackv4 tap0\r\n\r\n    let () =\r\n      register \"stackv4\" [mirage_logs (handler $ stack)]\r\n\r\nThis requires a patch to functoria: https://github.com/talex5/functoria/tree/logging\r\n\r\nIt's currently a bit hacky, but I'm sure someone who understands functoria can make it nicer. The key idea is that a `configurable` now gets given its lazy inputs directly, rather than having functoria force them automatically. This allows us to set up logging before forcing the dependencies.\r\n\r\n(However, if a dependency is also a dependency of logging then it will be forced first. For example, if you configure a network time source as the log time-stamper then networking will be initialised before logging. I think this is the desired behaviour.)\r\n\r\nNote: This patch is on top of the `better-errors` branch and is not as large as it looks. Just look at the last commit.\r\n\r\n/cc @Drup "},"comment":{"url":"https://api.github.com/repos/mirage/mirage/issues/comments/196286587","html_url":"https://github.com/mirage/mirage/pull/514#issuecomment-196286587","issue_url":"https://api.github.com/repos/mirage/mirage/issues/514","id":196286587,"user":{"login":"talex5","id":554131,"avatar_url":"https://avatars.githubusercontent.com/u/554131?v=3","gravatar_id":"","url":"https://api.github.com/users/talex5","html_url":"https://github.com/talex5","followers_url":"https://api.github.com/users/talex5/followers","following_url":"https://api.github.com/users/talex5/following{/other_user}","gists_url":"https://api.github.com/users/talex5/gists{/gist_id}","starred_url":"https://api.github.com/users/talex5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/talex5/subscriptions","organizations_url":"https://api.github.com/users/talex5/orgs","repos_url":"https://api.github.com/users/talex5/repos","events_url":"https://api.github.com/users/talex5/events{/privacy}","received_events_url":"https://api.github.com/users/talex5/received_events","type":"User","site_admin":false},"created_at":"2016-03-14T12:15:55Z","updated_at":"2016-03-14T12:15:55Z","body":"@drup I don't see any concrete proposal there. Passing the lazy values directly seems more general than having a list of startup jobs, but if you have something working I'm happy to try it."}}