mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-24 17:45:41 +00:00
7753213657
Former-commit-id: 08b46c2fe32bda46158eac46f82a2341bb1a93c2
24 lines
564 B
Go
24 lines
564 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/hay-kot/homebox/backend/internal/sys/config"
|
|
"github.com/rs/zerolog"
|
|
"github.com/rs/zerolog/log"
|
|
)
|
|
|
|
// setupLogger initializes the zerolog config
|
|
// for the shared logger.
|
|
func (a *app) setupLogger() {
|
|
// Logger Init
|
|
// zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
|
|
if a.conf.Log.Format != config.LogFormatJSON {
|
|
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}).With().Caller().Logger()
|
|
}
|
|
|
|
level, err := zerolog.ParseLevel(a.conf.Log.Level)
|
|
if err == nil {
|
|
zerolog.SetGlobalLevel(level)
|
|
}
|
|
}
|