zero

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2020 License: MIT Imports: 7 Imported by: 0

README

Zerolog

Zerolog logger implementation for go-micro meta logger.

Usage

func ExampleWithOut() {
  l := zero.NewLogger(zero.WithOut(os.Stdout), zero.WithLevel(logger.DebugLevel))

  l.Logf(logger.InfoLevel, "testing: %s", "logf")

  // Output:
  // {"level":"info","message":"testing: logf"}
}

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(opts ...logger.Option) logger.Logger

NewLogger builds a new logger based on options

func WithColor

func WithColor(useColor bool) logger.Option

func WithExitFunc

func WithExitFunc(exit func(int)) logger.Option

func WithHooks

func WithHooks(hooks []zerolog.Hook) logger.Option

func WithLevel

func WithLevel(lvl logger.Level) logger.Option

func WithLevelFieldName

func WithLevelFieldName(levelFieldName string) logger.Option

func WithOut

func WithOut(out io.Writer) logger.Option
Example
l := NewLogger(WithOut(os.Stdout), WithLevel(logger.DebugLevel))

l.Logf(logger.InfoLevel, "testing: %s", "logf")
Output:

{"level":"info","message":"testing: logf"}

func WithPretty

func WithPretty(pretty bool) logger.Option

func WithReportCaller

func WithReportCaller(reportCaller bool) logger.Option

func WithTimeFieldFormat

func WithTimeFieldFormat(formatter zerolog.Formatter) logger.Option

func ZerologToLoggerLevel

func ZerologToLoggerLevel(level zerolog.Level) logger.Level

Types

type Options

type Options struct {
	logger.Options
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL