-
-// daemonLogger returns the logger of the part of the daemon with prefix, such
-// as "telegram: ", on out. The journal adds the time to each line and sets
-// JOURNAL_STREAM for a service, so then the lines have no time stamp. Otherwise
-// each line has the standard time stamp.
-func daemonLogger(out io.Writer, prefix string) *log.Logger {
- if os.Getenv("JOURNAL_STREAM") != "" {
- return log.New(out, prefix, 0)
- }
-
- return log.New(out, prefix, log.LstdFlags)
-}
-
-// durationText returns d for a log line: rounded to the second, or to the
-// millisecond when it is shorter than a second.
-func durationText(d time.Duration) string {
- if d < time.Second {
- return d.Round(time.Millisecond).String()
- }
-
- return d.Round(time.Second).String()
-}