log

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: BSD-3-Clause Imports: 7 Imported by: 365

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

	EnvKeyLogSeparator  = "FLOGO_LOG_SEPARATOR"
	DefaultLogSeparator = "\t"

	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 FieldAny

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

func FieldBinary

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

func FieldBool

func FieldBool(key string, val bool) Field

func FieldBools

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

func FieldByteString

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

func FieldByteStrings

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

func FieldDuration

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

func FieldDurations

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

func FieldError

func FieldError(err error) Field

func FieldErrors

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

func FieldFloat32

func FieldFloat32(key string, val float32) Field

func FieldFloat32s

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

func FieldFloat64

func FieldFloat64(key string, val float64) Field

func FieldFloat64s

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

func FieldInt

func FieldInt(key string, val int) Field

func FieldInt32

func FieldInt32(key string, val int32) Field

func FieldInt64

func FieldInt64(key string, val int64) Field

func FieldInt64s

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

func FieldInts

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

func FieldNamedError

func FieldNamedError(key string, err error) Field

func FieldNamespace

func FieldNamespace(key string) Field

Namespace see zap.Namespace

func FieldObject

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

Object encodes object using reflection

func FieldSkip

func FieldSkip() Field

Skip see zap.Skip

func FieldStack

func FieldStack(key string) Field

func FieldString

func FieldString(key string, val string) Field

func FieldStringer

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

func FieldStrings

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

func FieldTime

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

func FieldTimes

func FieldTimes(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 CreateLoggerFromRef added in v1.3.0

func CreateLoggerFromRef(logger Logger, contributionType, ref string) 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