moving log to custom simplelog
This commit is contained in:
parent
6522b08704
commit
2d7edca680
@ -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) }
|
|
2
main.go
2
main.go
@ -2,8 +2,8 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"git.staur.ca/stobbsm/clustvirt/cluster"
|
"git.staur.ca/stobbsm/clustvirt/cluster"
|
||||||
"git.staur.ca/stobbsm/clustvirt/lib/log"
|
|
||||||
"git.staur.ca/stobbsm/clustvirt/router/server"
|
"git.staur.ca/stobbsm/clustvirt/router/server"
|
||||||
|
log "git.staur.ca/stobbsm/simplelog"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user