log/logr
A logr LogSink implementation.
Usage
import (
"github.com/phuslu/log/logr"
"github.com/phuslu/log"
)
func main() {
logger := logr.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 log/logr.
Levels in log/logr correspond to custom debug levels in Phuslog. Any given level
in log/logr 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
.