log

package
v0.0.0-...-261bb52 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(c *Config)

Init is initial func

Types

type Config

type Config struct {
	LogPath     string `mapstructure:"log_path"`
	LogLevel    string `mapstructure:"log_level"`
	ServiceName string `mapstructure:"service_name"`
}

Config is log conf

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory is the default logging wrapper that can create sLogger instances either for a given Context or context-less.

var XFactory Factory

XFactory is default factory

func NewFactory

func NewFactory(logger *zap.Logger) Factory

NewFactory creates a new Factory.

func With

func With(fields ...zapcore.Field) Factory

With creates a child sLogger, and optionally adds some context fields to that sLogger.

func (Factory) Bg

func (b Factory) Bg() Logger

Bg creates a context-unaware sLogger.

func (Factory) For

func (b Factory) For(ctx context.Context) Logger

For returns a context-aware Logger. If the context contains an OpenTracing span, all logging calls are also echo-ed into the span.

func (Factory) With

func (b Factory) With(fields ...zapcore.Field) Factory

With creates a child sLogger, and optionally adds some context fields to that sLogger.

type Logger

type Logger interface {
	Info(msg string, fields ...zapcore.Field)
	Error(msg string, fields ...zapcore.Field)
	Fatal(msg string, fields ...zapcore.Field)
	Panic(msg string, fields ...zapcore.Field)
	With(fields ...zapcore.Field) Logger
	Warn(msg string, fields ...zapcore.Field)
}

Logger is a simplified abstraction of the zap.Logger

func Bg

func Bg() Logger

Bg creates a context-unaware sLogger.

func For

func For(ctx context.Context) Logger

For returns a context-aware Logger. If the context contains an OpenTracing span, all logging calls are also echo-ed into the span.

Jump to

Keyboard shortcuts

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