logger

package
v0.0.0-...-ace9696 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AuditTag = zap.Bool("audit", true)

	OperationFirstFields = []zapcore.Field{
		zap.Bool("first", true),
		zap.Bool("last", false),
		AuditTag,
	}

	OperationFirst = func() func() []interface{} {
		slice := MakeInterfaceSlice(OperationFirstFields)

		return func() []interface{} {
			return slice
		}
	}

	OperationContFields = []zapcore.Field{
		zap.Bool("first", false),
		zap.Bool("last", false),
		AuditTag,
	}

	OperationCont = func() func() []interface{} {
		slice := MakeInterfaceSlice(OperationContFields)

		return func() []interface{} {
			return slice
		}
	}

	OperationLastFields = []zapcore.Field{
		zap.Bool("first", false),
		zap.Bool("last", true),
		AuditTag,
	}

	OperationLast = func() func() []interface{} {
		slice := MakeInterfaceSlice(OperationLastFields)

		return func() []interface{} {
			return slice
		}
	}
)

Functions

func MakeInterfaceSlice

func MakeInterfaceSlice(zf []zapcore.Field) []interface{}

func NewTmpLogger

func NewTmpLogger() (*zap.SugaredLogger, error)

NewTmpLogger create SugaredLogger. It is used to keep a log at startup. For example before loading config file.

Types

type Config

type Config struct {
	Development         bool     `json:"development"`
	Level               string   `json:"level"`
	Encoding            string   `json:"encoding"`
	OutputPaths         []string `json:"outputPaths"`
	AppErrorOutputPaths []string `json:"errorDispatcherPaths"` // Adjust to library
	ErrorOutputPaths    []string `json:"errorOutputPaths"`
	EncoderConfig       EncoderConfig
}

type EncoderConfig

type EncoderConfig struct {
	MessageKey    string `json:"messageKey"`
	LevelKey      string `json:"levelKey"`
	TimeKey       string `json:"timeKey"`
	NameKey       string `json:"nameKey"`
	CallerKey     string `json:"callerKey"`
	StacktraceKey string `json:"stacktraceKey"`
	LevelEncoder  string `json:"levelEncoder"`
	CallerEncoder string `json:"callerEncoder"`
}

type Logger

type Logger struct {
	*zap.Logger
}

func NewDefaultLogger

func NewDefaultLogger() (*Logger, error)

func NewLogger

func NewLogger(c Config) (*Logger, error)

func (*Logger) Panic

func (a *Logger) Panic(err interface{})

Jump to

Keyboard shortcuts

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