Phuslogr
A logr LogSink implementation using Phuslog.
Usage
import (
"github.com/phuslu/phuslogr"
"github.com/phuslu/log"
)
func main() {
logger := phuslogr.New(&log.Logger{
Level: log.InfoLevel,
TimeFormat: "15:04:05",
Caller: 1,
Writer: &log.ConsoleWriter{
ColorOutput: true,
QuoteString: false,
EndWithMessage: false,
},
})
logger.Info("Logr in action!", "the answer", 42)
}
Implementation Details
For the most part, concepts in Phuslog correspond directly with those in phuslogr.
Levels in phuslogr correspond to custom debug levels in Phuslog. Any given level
in phuslogr is represents by phuslogLevel = 1 - logrLevel
.
For example V(2)
is equivalent to Phuslog's TraceLevel
, while V(1)
is
equivalent to Phuslog's DebugLevel
.