log

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SamplingFreqFlagName flag name
	SamplingFreqFlagName = "log-sampling-frequency"
	// LevelFlagName flag name
	LevelFlagName = "log-level"
	// FormatFlagName flag name
	FormatFlagName = "log-format"
	// WithColorFlagName flag name
	WithColorFlagName = "log-enable-color"
	// IgnoreCallerFlagName caller flag
	IgnoreCallerFlagName = "log-ignore-caller"
	// OutputPathsName path name
	OutputPathsName = "log-output-paths"
)

Variables

View Source
var (
	Any         = zap.Any
	Array       = zap.Array
	Object      = zap.Object
	Binary      = zap.Binary
	Bool        = zap.Bool
	Bools       = zap.Bools
	ByteString  = zap.ByteString
	ByteStrings = zap.ByteStrings
	Complex64   = zap.Complex64
	Complex64s  = zap.Complex64s
	Complex128  = zap.Complex128
	Complex128s = zap.Complex128s
	Duration    = zap.Duration
	Durations   = zap.Durations
	Err         = zap.Error
	Errors      = zap.Errors
	Float32     = zap.Float32
	Float32s    = zap.Float32s
	Float64     = zap.Float64
	Float64s    = zap.Float64s
	Int         = zap.Int
	Ints        = zap.Ints
	Int8        = zap.Int8
	Int8s       = zap.Int8s
	Int16       = zap.Int16
	Int16s      = zap.Int16s
	Int32       = zap.Int32
	Int32s      = zap.Int32s
	Int64       = zap.Int64
	Int64s      = zap.Int64s
	Namespace   = zap.Namespace
	Reflect     = zap.Reflect
	Stack       = zap.Stack
	String      = zap.String
	Stringer    = zap.Stringer
	Strings     = zap.Strings
	Time        = zap.Time
	Times       = zap.Times
	Uint        = zap.Uint
	Uints       = zap.Uints
	Uint8       = zap.Uint8
	Uint8s      = zap.Uint8s
	Uint16      = zap.Uint16
	Uint16s     = zap.Uint16s
	Uint32      = zap.Uint32
	Uint32s     = zap.Uint32s
	Uint64      = zap.Uint64
	Uint64s     = zap.Uint64s
	Uintptr     = zap.Uintptr
	Uintptrs    = zap.Uintptrs
)

nolint: golint

Functions

func AddFlags

func AddFlags(fs *pflag.FlagSet)

AddFlags registers this package's flags on arbitrary FlagSets, such that they point to the same value as the global flags.

func Check

func Check(level int32) bool

Check return if logging a message at the specified level is enabled.

func Debug

func Debug(msg string, fields ...Field)

Debug method output debug level log.

func Debugf

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

Debugf uses fmt.Sprintf to log a templated message.

func Error

func Error(msg string, fields ...Field)

Error method output error level log.

func Errorf

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

Errorf uses fmt.Sprintf to log a templated message.

func Fatal

func Fatal(msg string, fields ...Field)

Fatal method output fatal level log.

func Fatalf

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

Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.

func FlushLogger

func FlushLogger()

FlushLogger calls the underlying Core's Sync method, flushing any buffered log entries. Applications should take care to call Sync before exiting.

func Format

func Format() string

Format return the current log format

func Info

func Info(msg string, fields ...Field)

Info method output info level log.

func Infof

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

Infof uses fmt.Sprintf to log a templated message.

func InitLogger

func InitLogger()

InitLogger initializes logger the way we want for tke.

func Level

func Level() string

Level returns the current log level

func MustParseFormat

func MustParseFormat() string

MustParseFormat to parse the log format flag

func MustParseLevel

func MustParseLevel() string

MustParseLevel to parse the log level flag

func Panic

func Panic(msg string, fields ...Field)

Panic method output panic level log and shutdown application.

func Panicf

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

Panicf uses fmt.Sprintf to log a templated message, then panics.

func Reset

func Reset()

Reset to recreate the logger by changed flag params

func SetFormat

func SetFormat(format string) error

SetFormat to change the log format flag

func SetLevel

func SetLevel(level string) error

SetLevel to change the log level flag

func StdErrLogger

func StdErrLogger() *log.Logger

StdErrLogger returns logger of standard library which writes to supplied zap logger at error level

func StdInfoLogger

func StdInfoLogger() *log.Logger

StdInfoLogger returns logger of standard library which writes to supplied zap logger at info level

func Warn

func Warn(msg string, fields ...Field)

Warn method output warning level log.

func Warnf

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

Warnf uses fmt.Sprintf to log a templated message.

func ZapLogger

func ZapLogger() *zap.Logger

ZapLogger returns zap logger instance.

Types

type Field

type Field = zapcore.Field

Field is an alias for the field structure in the underlying log frame

Jump to

Keyboard shortcuts

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