log

package
v0.9.0-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: BSD-3-Clause Imports: 6 Imported by: 412

Documentation

Index

Constants

View Source
const (
	EnvKeyLogCtx         = "FLOGO_LOG_CTX"
	EnvKeyLogDateFormat  = "FLOGO_LOG_DTFORMAT"
	DefaultLogDateFormat = "2006-01-02 15:04:05.000"
	EnvKeyLogLevel       = "FLOGO_LOG_LEVEL"
	DefaultLogLevel      = InfoLevel
	EnvKeyLogFormat      = "FLOGO_LOG_FORMAT"
	DefaultLogFormat     = FormatConsole

	TraceLevel Level = iota
	DebugLevel
	InfoLevel
	WarnLevel
	ErrorLevel

	FormatConsole Format = iota
	FormatJson
)

Variables

This section is empty.

Functions

func CtxLoggingEnabled

func CtxLoggingEnabled() bool

func SetLogLevel

func SetLogLevel(logger Logger, level Level)

func Sync

func Sync()

Types

type Field

type Field = interface{}

func Any

func Any(key string, val interface{}) Field

func Binary

func Binary(key string, val []byte) Field

func Bool

func Bool(key string, val bool) Field

func Bools

func Bools(key string, vals []bool) Field

func ByteString

func ByteString(key string, val []byte) Field

func ByteStrings

func ByteStrings(key string, vals [][]byte) Field

func Duration

func Duration(key string, val time.Duration) Field

func Durations

func Durations(key string, vals []time.Duration) Field

func Error

func Error(err error) Field

func Errors

func Errors(key string, errs []error) Field

func Float32

func Float32(key string, val float32) Field

func Float32s

func Float32s(key string, vals []float32) Field

func Float64

func Float64(key string, val float64) Field

func Float64s

func Float64s(key string, vals []float64) Field

func Int

func Int(key string, val int) Field

func Int32

func Int32(key string, val int32) Field

func Int64

func Int64(key string, val int64) Field

func Int64s

func Int64s(key string, vals []int64) Field

func Ints

func Ints(key string, vals []int) Field

func NamedError

func NamedError(key string, err error) Field

func Namespace

func Namespace(key string) Field

Namespace see zap.Namespace

func Object

func Object(key string, val interface{}) Field

Object encodes object using reflection

func Skip

func Skip() Field

Skip see zap.Skip

func Stack

func Stack(key string) Field

func String

func String(key string, val string) Field

func Stringer

func Stringer(key string, val fmt.Stringer) Field

func Strings

func Strings(key string, vals []string) Field

func Time

func Time(key string, val time.Time) Field

func Times

func Times(key string, vals []time.Time) Field

type Format

type Format int

type Level

type Level int

func ToLogLevel

func ToLogLevel(lvlStr string) Level

type Logger

type Logger interface {
	DebugEnabled() bool
	TraceEnabled() bool

	Trace(args ...interface{})
	Debug(args ...interface{})
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})

	Tracef(template string, args ...interface{})
	Debugf(template string, args ...interface{})
	Infof(template string, args ...interface{})
	Warnf(template string, args ...interface{})
	Errorf(template string, args ...interface{})

	Structured() StructuredLogger
}

func ChildLogger

func ChildLogger(logger Logger, name string) Logger

func ChildLoggerWithFields

func ChildLoggerWithFields(logger Logger, fields ...Field) Logger

func RootLogger

func RootLogger() Logger

type StructuredLogger

type StructuredLogger interface {
	Debug(msg string, fields ...Field)
	Info(msg string, fields ...Field)
	Warn(msg string, fields ...Field)
	Error(msg string, fields ...Field)
}

Jump to

Keyboard shortcuts

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