moving log to custom simplelog

This commit is contained in:
Matthew Stobbs 2024-04-03 23:43:54 -06:00
parent 6522b08704
commit 2d7edca680
2 changed files with 1 additions and 31 deletions

View File

@ -1,30 +0,0 @@
// Package logs provides a central location for ClustVirt logging, wrapping a Zerolog
// instance to do the job.
// This will standarize logging throughout ClustVirt, and make it easier to debug
// issues.
// The default is to log to Stderr
// TODO: enable logging to syslog through configuration
package log
import (
"os"
"github.com/rs/zerolog"
)
var defaultLogger zerolog.Logger
func init() {
defaultLogger = zerolog.New(zerolog.ConsoleWriter{
Out: os.Stderr,
TimeFormat: zerolog.TimeFormatUnix,
})
}
func Trace(method string) *zerolog.Event { return defaultLogger.Trace().Str("method", method) }
func Debug(method string) *zerolog.Event { return defaultLogger.Debug().Str("method", method) }
func Info(method string) *zerolog.Event { return defaultLogger.Info().Str("method", method) }
func Warn(method string) *zerolog.Event { return defaultLogger.Warn().Str("method", method) }
func Error(method string) *zerolog.Event { return defaultLogger.Error().Str("method", method) }
func Fatal(method string) *zerolog.Event { return defaultLogger.Fatal().Str("method", method) }
func Panic(method string) *zerolog.Event { return defaultLogger.Panic().Str("method", method) }

View File

@ -2,8 +2,8 @@ package main
import (
"git.staur.ca/stobbsm/clustvirt/cluster"
"git.staur.ca/stobbsm/clustvirt/lib/log"
"git.staur.ca/stobbsm/clustvirt/router/server"
log "git.staur.ca/stobbsm/simplelog"
)
func main() {