Compare commits
No commits in common. "main" and "0.0.3" have entirely different histories.
|
@ -14,11 +14,12 @@ let no_timestamp = Option.is_some (Sys.getenv_opt "LOG_NO_TIMESTAMP")
|
||||||
let no_namespace = Option.is_some (Sys.getenv_opt "LOG_NO_NAMESPACE")
|
let no_namespace = Option.is_some (Sys.getenv_opt "LOG_NO_NAMESPACE")
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
if Logging.should_upgrade_to_journald () then
|
match Sys.getenv_opt "JOURNAL_STREAM" with
|
||||||
|
| Some _ ->
|
||||||
Logging.init_journald_writer ()
|
Logging.init_journald_writer ()
|
||||||
~min_level
|
~min_level
|
||||||
else
|
| None ->
|
||||||
Logging.init_pretty_writer stdout
|
Logging.init_pretty_writer stderr
|
||||||
~min_level
|
~min_level
|
||||||
~color:(not no_color)
|
~color:(not no_color)
|
||||||
~timestamp:(not no_timestamp)
|
~timestamp:(not no_timestamp)
|
||||||
|
|
|
@ -9,11 +9,6 @@ type t = {
|
||||||
buf : Buffer.t;
|
buf : Buffer.t;
|
||||||
}
|
}
|
||||||
|
|
||||||
let should_upgrade () =
|
|
||||||
let stderr = Unix.fstat Unix.stderr in
|
|
||||||
let dev_ino = Printf.sprintf "%d:%d" stderr.st_dev stderr.st_ino in
|
|
||||||
Sys.getenv_opt "JOURNAL_STREAM" = Some dev_ino
|
|
||||||
|
|
||||||
let make ?(path = default_socket_path) () = {
|
let make ?(path = default_socket_path) () = {
|
||||||
mutex = Mutex.create ();
|
mutex = Mutex.create ();
|
||||||
sock_fd = Unix.socket PF_UNIX SOCK_DGRAM 0 ~cloexec:true;
|
sock_fd = Unix.socket PF_UNIX SOCK_DGRAM 0 ~cloexec:true;
|
||||||
|
|
|
@ -107,5 +107,3 @@ let init_journald_writer
|
||||||
Journald.make () ?path |>
|
Journald.make () ?path |>
|
||||||
Journald.writer |>
|
Journald.writer |>
|
||||||
add_writer ?min_level
|
add_writer ?min_level
|
||||||
|
|
||||||
let should_upgrade_to_journald = Journald.should_upgrade
|
|
||||||
|
|
|
@ -36,5 +36,3 @@ val init_journald_writer :
|
||||||
?min_level:level ->
|
?min_level:level ->
|
||||||
?path:string ->
|
?path:string ->
|
||||||
unit -> unit
|
unit -> unit
|
||||||
|
|
||||||
val should_upgrade_to_journald : unit -> bool
|
|
||||||
|
|
Loading…
Reference in New Issue