]> git.giacomolli.uk - onechat/blobdiff - daemon_log.go
Order daemon and storage declarations
[onechat] / daemon_log.go
index ef1360cc8ba88ac2eae59190e1b5db7b32fbc561..f1e4b0bf4ad0c4c111a9f1f4d3b63c71b99f00bf 100644 (file)
@@ -11,18 +11,6 @@ import (
        "time"
 )
 
-// daemonLogger returns a logger for one daemon part. JOURNAL_STREAM selects
-// syslog priorities without a time stamp. Other output carries the standard
-// time stamp and level.
-func daemonLogger(out io.Writer, prefix string) *slog.Logger {
-       return slog.New(&DaemonLogHandler{
-               out:     out,
-               prefix:  prefix,
-               journal: os.Getenv("JOURNAL_STREAM") != "",
-               mutex:   &sync.Mutex{},
-       })
-}
-
 // DaemonLogHandler writes short event lines with ordered attributes. Copies
 // share the writer lock. The err attribute follows all other attributes as a
 // cause. Journal lines carry a syslog priority instead of a time and level.
@@ -116,6 +104,18 @@ func (h *DaemonLogHandler) WithGroup(name string) slog.Handler {
        return &clone
 }
 
+// daemonLogger returns a logger for one daemon part. JOURNAL_STREAM selects
+// syslog priorities without a time stamp. Other output carries the standard
+// time stamp and level.
+func daemonLogger(out io.Writer, prefix string) *slog.Logger {
+       return slog.New(&DaemonLogHandler{
+               out:     out,
+               prefix:  prefix,
+               journal: os.Getenv("JOURNAL_STREAM") != "",
+               mutex:   &sync.Mutex{},
+       })
+}
+
 // daemonLogAttr resolves and writes one attribute, or keeps its cause for the
 // end of the line. Groups flatten into dotted keys and empty attributes produce
 // no text.