log

package
v2.33.17 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 14 Imported by: 21

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

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 SetDefaultField added in v2.2.5

func SetDefaultField(key string, value interface{})

func SetDefaultService added in v2.2.5

func SetDefaultService(value string)

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

type Field = zapcore.Field

type Fields

type Fields = []Field

type Level

type Level = zapcore.Level

type Logger

type Logger interface {
	WithClientID(ctx context.Context) Logger
	WithField(key string, value interface{}) Logger
	WithFields(fields Fields) Logger
	WithError(err error) Logger
	WithTracing(ctx context.Context) Logger
	WithUserID(ctx context.Context) Logger
	OnlyWithTracing(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 NewSampleLogger added in v2.4.0

func NewSampleLogger(tick time.Duration, first, thereafter int) Logger

NewSampleLogger will create a new logger which will sample logs and dropped if requested to often Logs which is written within `tick` be applied by first and thereafter `first` is amount of logs that will always will be outputted `thereafter` is used for outputten every n after within the `tick`

func Nop added in v2.20.0

func Nop() Logger

func OnlyWithTracing added in v2.32.1

func OnlyWithTracing(ctx context.Context) Logger

func WithClientID added in v2.25.1

func WithClientID(ctx context.Context) 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

func WithTracing(ctx context.Context) Logger

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

func WithUserID

func WithUserID(ctx context.Context) Logger

Jump to

Keyboard shortcuts

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