Documentation ¶
Index ¶
Constants ¶
View Source
const ( DEBUG = iota + 1 INFO WARNING Error FATAL )
Variables ¶
View Source
var DefaultLogger = &context{ keyvals: []string{}, v: INFO, log: zerolog.New(os.Stderr).With().Timestamp().CallerWithSkipFrameCount(4).Logger()}
View Source
var ErrKeyValNoCorrespondence = errors.New("err:key and value isn't correspondence")
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface { V(v int) bool // V is level's With() Logger // With is create a new logger WithKeyvals(keyvals ...string) error // WithKeyvals is append prefix Info(msg string) // INFO log Infof(msg string, a ...interface{}) // INFO log Error(msg string) // Error Log Errorf(msg string, a ...interface{}) // Error Log }
Logger is a log interface
func NewLogger ¶
func NewLogger(opts ...LoggerOption) (Logger, error)
NewLogger is new a logger logger is a log interface
type LoggerOption ¶
type LoggerOption func(c *context)
func WithCaller ¶
func WithCaller() LoggerOption
func WithKeyvals ¶
func WithKeyvals(keyvals ...string) LoggerOption
func WithTime ¶
func WithTime() LoggerOption
Click to show internal directories.
Click to hide internal directories.