{"action":"created","comment":{"url":"https://api.github.com/repos/openvstorage/alba/pulls/comments/52442476","id":52442476,"diff_hunk":"@@ -17,20 +17,80 @@ limitations under the License.\n open Cmdliner\n open Lwt.Infix\n \n-let install_logger ?(channel=Lwt_io.stdout) ~verbose () =\n+let stderr_logger =\n+  let mutex = Lwt_mutex.create () in\n+  let lg_output line =\n+    Lwt_mutex.with_lock\n+      mutex\n+      (fun () ->\n+       Lwt_io.write Lwt_io.stderr line >>= fun () ->\n+       Lwt_io.write_char Lwt_io.stdout '\\n')\n+  in\n+  let close () = Lwt.return_unit in\n+  lg_output, close\n+\n+let log_sinks =\n+  Arg.(value\n+       & opt_all string [ \"console:\" ]\n+       & info [\"log-sink\"]\n+              ~doc:\"specify log output sinks (e.g. console:, /path/to/file or redis://localhost[:port]/key\")\n+\n+let install_logger ?(log_sinks=`Stdout) ~subcomponent ~verbose () =\n   let level =\n     if verbose\n     then Lwt_log.Debug\n     else Lwt_log.Info\n   in\n   Lwt_log.append_rule \"*\" level;\n-  let logger =\n-    Lwt_log.channel\n-      ~template:\"$(date).$(milliseconds) $(section) $(level): $(message)\"\n-      ~close_mode:`Keep\n-      ~channel ()\n+\n+  begin\n+    match log_sinks with\n+    | `Arakoon_sinks log_sinks ->\n+       Lwt_list.map_p\n+         (fun log_sink ->\n+          let open Arakoon_log_sink in\n+          match make log_sink with\n+          | File file_name ->\n+             Arakoon_logger.file_logger file_name\n+          | Redis (host, port, key) ->\n+             Arakoon_redis.make_redis_logger\n+               ~host ~port ~key\n+             |> Lwt.return\n+          | Console ->\n+             Lwt.return Arakoon_logger.console_logger)\n+         log_sinks\n+    | `Stdout ->\n+       Lwt.return [ Arakoon_logger.console_logger ]\n+    | `Stderr ->\n+       Lwt.return [ stderr_logger ]\n+  end >>= fun loggers ->\n+\n+  let hostname = Unix.gethostname () in\n+  let component = Printf.sprintf \"alba/%s\" subcomponent in\n+  let pid = Unix.getpid () in\n+  let seqnum = ref 0 in\n+  let logger = Lwt_log.make\n+                 ~output:(fun section level lines ->\n+                          let seqnum' = !seqnum in\n+                          let () = incr seqnum in\n+                          let ts = Core.Time.now () in","path":"ocaml/src/cli_common.ml","position":66,"original_position":66,"commit_id":"eb11d24ee2cb24cacf0e5bc4cbad2e3309371d1d","original_commit_id":"eb11d24ee2cb24cacf0e5bc4cbad2e3309371d1d","user":{"login":"toolslive","id":1249832,"avatar_url":"https://avatars.githubusercontent.com/u/1249832?v=3","gravatar_id":"","url":"https://api.github.com/users/toolslive","html_url":"https://github.com/toolslive","followers_url":"https://api.github.com/users/toolslive/followers","following_url":"https://api.github.com/users/toolslive/following{/other_user}","gists_url":"https://api.github.com/users/toolslive/gists{/gist_id}","starred_url":"https://api.github.com/users/toolslive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toolslive/subscriptions","organizations_url":"https://api.github.com/users/toolslive/orgs","repos_url":"https://api.github.com/users/toolslive/repos","events_url":"https://api.github.com/users/toolslive/events{/privacy}","received_events_url":"https://api.github.com/users/toolslive/received_events","type":"User","site_admin":false},"body":"core as a dependency in myocamlbuild.ml","created_at":"2016-02-10T10:56:33Z","updated_at":"2016-02-10T10:56:33Z","html_url":"https://github.com/openvstorage/alba/pull/136#discussion_r52442476","pull_request_url":"https://api.github.com/repos/openvstorage/alba/pulls/136","_links":{"self":{"href":"https://api.github.com/repos/openvstorage/alba/pulls/comments/52442476"},"html":{"href":"https://github.com/openvstorage/alba/pull/136#discussion_r52442476"},"pull_request":{"href":"https://api.github.com/repos/openvstorage/alba/pulls/136"}}},"pull_request":{"url":"https://api.github.com/repos/openvstorage/alba/pulls/136","id":58872694,"html_url":"https://github.com/openvstorage/alba/pull/136","diff_url":"https://github.com/openvstorage/alba/pull/136.diff","patch_url":"https://github.com/openvstorage/alba/pull/136.patch","issue_url":"https://api.github.com/repos/openvstorage/alba/issues/136","number":136,"state":"open","locked":false,"title":"Redis logging","user":{"login":"domsj","id":89326,"avatar_url":"https://avatars.githubusercontent.com/u/89326?v=3","gravatar_id":"","url":"https://api.github.com/users/domsj","html_url":"https://github.com/domsj","followers_url":"https://api.github.com/users/domsj/followers","following_url":"https://api.github.com/users/domsj/following{/other_user}","gists_url":"https://api.github.com/users/domsj/gists{/gist_id}","starred_url":"https://api.github.com/users/domsj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domsj/subscriptions","organizations_url":"https://api.github.com/users/domsj/orgs","repos_url":"https://api.github.com/users/domsj/repos","events_url":"https://api.github.com/users/domsj/events{/privacy}","received_events_url":"https://api.github.com/users/domsj/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-10T10:38:15Z","updated_at":"2016-02-10T10:56:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9b3604c43fc706d65a4aae7c8c2073f45afaae5b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openvstorage/alba/pulls/136/commits","review_comments_url":"https://api.github.com/repos/openvstorage/alba/pulls/136/comments","review_comment_url":"https://api.github.com/repos/openvstorage/alba/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openvstorage/alba/issues/136/comments","statuses_url":"https://api.github.com/repos/openvstorage/alba/statuses/eb11d24ee2cb24cacf0e5bc4cbad2e3309371d1d","head":{"label":"openvstorage:redis-log","ref":"redis-log","sha":"eb11d24ee2cb24cacf0e5bc4cbad2e3309371d1d","user":{"login":"openvstorage","id":12763393,"avatar_url":"https://avatars.githubusercontent.com/u/12763393?v=3","gravatar_id":"","url":"https://api.github.com/users/openvstorage","html_url":"https://github.com/openvstorage","followers_url":"https://api.github.com/users/openvstorage/followers","following_url":"https://api.github.com/users/openvstorage/following{/other_user}","gists_url":"https://api.github.com/users/openvstorage/gists{/gist_id}","starred_url":"https://api.github.com/users/openvstorage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openvstorage/subscriptions","organizations_url":"https://api.github.com/users/openvstorage/orgs","repos_url":"https://api.github.com/users/openvstorage/repos","events_url":"https://api.github.com/users/openvstorage/events{/privacy}","received_events_url":"https://api.github.com/users/openvstorage/received_events","type":"Organization","site_admin":false},"repo":{"id":38867740,"name":"alba","full_name":"openvstorage/alba","owner":{"login":"openvstorage","id":12763393,"avatar_url":"https://avatars.githubusercontent.com/u/12763393?v=3","gravatar_id":"","url":"https://api.github.com/users/openvstorage","html_url":"https://github.com/openvstorage","followers_url":"https://api.github.com/users/openvstorage/followers","following_url":"https://api.github.com/users/openvstorage/following{/other_user}","gists_url":"https://api.github.com/users/openvstorage/gists{/gist_id}","starred_url":"https://api.github.com/users/openvstorage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openvstorage/subscriptions","organizations_url":"https://api.github.com/users/openvstorage/orgs","repos_url":"https://api.github.com/users/openvstorage/repos","events_url":"https://api.github.com/users/openvstorage/events{/privacy}","received_events_url":"https://api.github.com/users/openvstorage/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openvstorage/alba","description":"Open vStorage alternate backend creates a replicated or flexible network raid’ed  object storage backend out of Seagate Kinetic drives and local disk supporting compression, encryption.","fork":false,"url":"https://api.github.com/repos/openvstorage/alba","forks_url":"https://api.github.com/repos/openvstorage/alba/forks","keys_url":"https://api.github.com/repos/openvstorage/alba/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openvstorage/alba/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openvstorage/alba/teams","hooks_url":"https://api.github.com/repos/openvstorage/alba/hooks","issue_events_url":"https://api.github.com/repos/openvstorage/alba/issues/events{/number}","events_url":"https://api.github.com/repos/openvstorage/alba/events","assignees_url":"https://api.github.com/repos/openvstorage/alba/assignees{/user}","branches_url":"https://api.github.com/repos/openvstorage/alba/branches{/branch}","tags_url":"https://api.github.com/repos/openvstorage/alba/tags","blobs_url":"https://api.github.com/repos/openvstorage/alba/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openvstorage/alba/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openvstorage/alba/git/refs{/sha}","trees_url":"https://api.github.com/repos/openvstorage/alba/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openvstorage/alba/statuses/{sha}","languages_url":"https://api.github.com/repos/openvstorage/alba/languages","stargazers_url":"https://api.github.com/repos/openvstorage/alba/stargazers","contributors_url":"https://api.github.com/repos/openvstorage/alba/contributors","subscribers_url":"https://api.github.com/repos/openvstorage/alba/subscribers","subscription_url":"https://api.github.com/repos/openvstorage/alba/subscription","commits_url":"https://api.github.com/repos/openvstorage/alba/commits{/sha}","git_commits_url":"https://api.github.com/repos/openvstorage/alba/git/commits{/sha}","comments_url":"https://api.github.com/repos/openvstorage/alba/comments{/number}","issue_comment_url":"https://api.github.com/repos/openvstorage/alba/issues/comments{/number}","contents_url":"https://api.github.com/repos/openvstorage/alba/contents/{+path}","compare_url":"https://api.github.com/repos/openvstorage/alba/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openvstorage/alba/merges","archive_url":"https://api.github.com/repos/openvstorage/alba/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openvstorage/alba/downloads","issues_url":"https://api.github.com/repos/openvstorage/alba/issues{/number}","pulls_url":"https://api.github.com/repos/openvstorage/alba/pulls{/number}","milestones_url":"https://api.github.com/repos/openvstorage/alba/milestones{/number}","notifications_url":"https://api.github.com/repos/openvstorage/alba/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openvstorage/alba/labels{/name}","releases_url":"https://api.github.com/repos/openvstorage/alba/releases{/id}","deployments_url":"https://api.github.com/repos/openvstorage/alba/deployments","created_at":"2015-07-10T07:40:52Z","updated_at":"2016-01-11T14:23:24Z","pushed_at":"2016-02-10T10:38:15Z","git_url":"git://github.com/openvstorage/alba.git","ssh_url":"git@github.com:openvstorage/alba.git","clone_url":"https://github.com/openvstorage/alba.git","svn_url":"https://github.com/openvstorage/alba","homepage":"","size":19672,"stargazers_count":7,"watchers_count":7,"language":"OCaml","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":7,"default_branch":"master"}},"base":{"label":"openvstorage:master","ref":"master","sha":"e628de2300a1d2481ee6c54d98536d1245a33949","user":{"login":"openvstorage","id":12763393,"avatar_url":"https://avatars.githubusercontent.com/u/12763393?v=3","gravatar_id":"","url":"https://api.github.com/users/openvstorage","html_url":"https://github.com/openvstorage","followers_url":"https://api.github.com/users/openvstorage/followers","following_url":"https://api.github.com/users/openvstorage/following{/other_user}","gists_url":"https://api.github.com/users/openvstorage/gists{/gist_id}","starred_url":"https://api.github.com/users/openvstorage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openvstorage/subscriptions","organizations_url":"https://api.github.com/users/openvstorage/orgs","repos_url":"https://api.github.com/users/openvstorage/repos","events_url":"https://api.github.com/users/openvstorage/events{/privacy}","received_events_url":"https://api.github.com/users/openvstorage/received_events","type":"Organization","site_admin":false},"repo":{"id":38867740,"name":"alba","full_name":"openvstorage/alba","owner":{"login":"openvstorage","id":12763393,"avatar_url":"https://avatars.githubusercontent.com/u/12763393?v=3","gravatar_id":"","url":"https://api.github.com/users/openvstorage","html_url":"https://github.com/openvstorage","followers_url":"https://api.github.com/users/openvstorage/followers","following_url":"https://api.github.com/users/openvstorage/following{/other_user}","gists_url":"https://api.github.com/users/openvstorage/gists{/gist_id}","starred_url":"https://api.github.com/users/openvstorage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openvstorage/subscriptions","organizations_url":"https://api.github.com/users/openvstorage/orgs","repos_url":"https://api.github.com/users/openvstorage/repos","events_url":"https://api.github.com/users/openvstorage/events{/privacy}","received_events_url":"https://api.github.com/users/openvstorage/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openvstorage/alba","description":"Open vStorage alternate backend creates a replicated or flexible network raid’ed  object storage backend out of Seagate Kinetic drives and local disk supporting compression, encryption.","fork":false,"url":"https://api.github.com/repos/openvstorage/alba","forks_url":"https://api.github.com/repos/openvstorage/alba/forks","keys_url":"https://api.github.com/repos/openvstorage/alba/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openvstorage/alba/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openvstorage/alba/teams","hooks_url":"https://api.github.com/repos/openvstorage/alba/hooks","issue_events_url":"https://api.github.com/repos/openvstorage/alba/issues/events{/number}","events_url":"https://api.github.com/repos/openvstorage/alba/events","assignees_url":"https://api.github.com/repos/openvstorage/alba/assignees{/user}","branches_url":"https://api.github.com/repos/openvstorage/alba/branches{/branch}","tags_url":"https://api.github.com/repos/openvstorage/alba/tags","blobs_url":"https://api.github.com/repos/openvstorage/alba/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openvstorage/alba/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openvstorage/alba/git/refs{/sha}","trees_url":"https://api.github.com/repos/openvstorage/alba/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openvstorage/alba/statuses/{sha}","languages_url":"https://api.github.com/repos/openvstorage/alba/languages","stargazers_url":"https://api.github.com/repos/openvstorage/alba/stargazers","contributors_url":"https://api.github.com/repos/openvstorage/alba/contributors","subscribers_url":"https://api.github.com/repos/openvstorage/alba/subscribers","subscription_url":"https://api.github.com/repos/openvstorage/alba/subscription","commits_url":"https://api.github.com/repos/openvstorage/alba/commits{/sha}","git_commits_url":"https://api.github.com/repos/openvstorage/alba/git/commits{/sha}","comments_url":"https://api.github.com/repos/openvstorage/alba/comments{/number}","issue_comment_url":"https://api.github.com/repos/openvstorage/alba/issues/comments{/number}","contents_url":"https://api.github.com/repos/openvstorage/alba/contents/{+path}","compare_url":"https://api.github.com/repos/openvstorage/alba/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openvstorage/alba/merges","archive_url":"https://api.github.com/repos/openvstorage/alba/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openvstorage/alba/downloads","issues_url":"https://api.github.com/repos/openvstorage/alba/issues{/number}","pulls_url":"https://api.github.com/repos/openvstorage/alba/pulls{/number}","milestones_url":"https://api.github.com/repos/openvstorage/alba/milestones{/number}","notifications_url":"https://api.github.com/repos/openvstorage/alba/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openvstorage/alba/labels{/name}","releases_url":"https://api.github.com/repos/openvstorage/alba/releases{/id}","deployments_url":"https://api.github.com/repos/openvstorage/alba/deployments","created_at":"2015-07-10T07:40:52Z","updated_at":"2016-01-11T14:23:24Z","pushed_at":"2016-02-10T10:38:15Z","git_url":"git://github.com/openvstorage/alba.git","ssh_url":"git@github.com:openvstorage/alba.git","clone_url":"https://github.com/openvstorage/alba.git","svn_url":"https://github.com/openvstorage/alba","homepage":"","size":19672,"stargazers_count":7,"watchers_count":7,"language":"OCaml","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openvstorage/alba/pulls/136"},"html":{"href":"https://github.com/openvstorage/alba/pull/136"},"issue":{"href":"https://api.github.com/repos/openvstorage/alba/issues/136"},"comments":{"href":"https://api.github.com/repos/openvstorage/alba/issues/136/comments"},"review_comments":{"href":"https://api.github.com/repos/openvstorage/alba/pulls/136/comments"},"review_comment":{"href":"https://api.github.com/repos/openvstorage/alba/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openvstorage/alba/pulls/136/commits"},"statuses":{"href":"https://api.github.com/repos/openvstorage/alba/statuses/eb11d24ee2cb24cacf0e5bc4cbad2e3309371d1d"}}}}