log

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2019 License: MIT Imports: 9 Imported by: 4

README

Log package

Environment variable config

Variable Values
CONSOLE_LOGGER true / false
LOG_LEVEL debug / info / warn / error

Default logger is json-logger
Default log level is info

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckWrite added in v1.9.4

func CheckWrite(lvl Level, msg string, fields ...Field)

func Debug

func Debug(args ...interface{})

func Debugf

func Debugf(format string, args ...interface{})

func Error

func Error(args ...interface{})

func Errorf

func Errorf(format string, args ...interface{})

func Fatal

func Fatal(args ...interface{})

func Fatalf

func Fatalf(format string, args ...interface{})

func Info

func Info(args ...interface{})

func Infof

func Infof(format string, args ...interface{})

func Panic

func Panic(args ...interface{})

func Panicf

func Panicf(format string, args ...interface{})

func Warn

func Warn(args ...interface{})

func Warnf

func Warnf(format string, args ...interface{})

func Warning

func Warning(args ...interface{})

func Warningf

func Warningf(format string, args ...interface{})

Types

type Field added in v1.9.3

type Field = zapcore.Field

type Fields

type Fields = []Field

type Level added in v1.9.4

type Level = zapcore.Level

type Logger

type Logger interface {
	WithField(key string, value interface{}) Logger
	WithFields(fields Fields) Logger
	WithError(err error) Logger
	WithTracing(ctx context.Context) Logger

	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	Panicf(format string, args ...interface{})

	Debug(args ...interface{})
	Info(args ...interface{})
	Warn(args ...interface{})
	Warning(args ...interface{})
	Error(args ...interface{})
	Fatal(args ...interface{})
	Panic(args ...interface{})

	CheckWrite(lvl Level, msg string, fields ...Field)
	Sync() error
}

func Base

func Base() Logger

func WithError

func WithError(err error) Logger

func WithField

func WithField(key string, value interface{}) Logger

func WithFields

func WithFields(fields Fields) Logger

func WithTracing added in v1.7.0

func WithTracing(ctx context.Context) Logger

WithTracing will take an OpenCensus trace and add log fields for Datadog.

Jump to

Keyboard shortcuts

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