logger

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultLevel         = InfoLevel
	DefaultFlushInterval = time.Duration(3) * time.Second
)

Variables

View Source
var (
	NewDevelopmentConfig = zap.NewDevelopmentConfig
	NewProductionConfig  = zap.NewProductionConfig
)
View Source
var (
	NewConsoleEncoder = zapcore.NewConsoleEncoder
	NewJSONEncoder    = zapcore.NewJSONEncoder
)
View Source
var (
	NewDevelopmentEncoderConfig = zap.NewDevelopmentEncoderConfig
	NewProductionEncoderConfig  = zap.NewProductionEncoderConfig
)

Functions

func Debugw added in v0.13.0

func Debugw(msg string, keysAndValues ...interface{})

func Errorw added in v0.13.0

func Errorw(msg string, keysAndValues ...interface{})

func Fatalw added in v0.13.0

func Fatalw(msg string, keysAndValues ...interface{})

func Infow added in v0.13.0

func Infow(msg string, keysAndValues ...interface{})

func Init

func Init(cfg LoggingConfig)

Init sets the package-level base logger using given config It's not thread safe so if required use it always at the beginning

func Log added in v0.11.0

func Log(lvl Level, innerAggregation bool, msg string, keysAndValues ...interface{})

Log is a generic helper that allows logging by choosing the desired level and if the aggregation should be done. It does NOT override those options. For the case where innerAggregation is set to true, it will only aggregate if pkg logger's aggregation config is also set to true.

func SetLogger added in v0.14.0

func SetLogger(l LoggerInterface)

SetLogger sets package-level base logger It's not thread safe so if required use it always at the beginning

func Warnw added in v0.13.0

func Warnw(msg string, keysAndValues ...interface{})

Types

type Config

type Config = zap.Config

type Encoder

type Encoder = zapcore.Encoder

type EncoderConfig

type EncoderConfig = zapcore.EncoderConfig

type Level

type Level = zapcore.Level
const (
	DebugLevel  Level = zap.DebugLevel
	InfoLevel   Level = zap.InfoLevel
	WarnLevel   Level = zap.WarnLevel
	ErrorLevel  Level = zap.ErrorLevel
	DPanicLevel Level = zap.DPanicLevel
	PanicLevel  Level = zap.PanicLevel
	FatalLevel  Level = zap.FatalLevel
)

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger struct

func Current added in v0.13.0

func Current() *Logger

Current returns the package-level base logger

func (*Logger) Debugw added in v0.13.0

func (l *Logger) Debugw(msg string, keysAndValues ...interface{})

func (*Logger) Errorw added in v0.13.0

func (l *Logger) Errorw(msg string, keysAndValues ...interface{})

func (*Logger) Fatalw added in v0.13.0

func (l *Logger) Fatalw(msg string, keysAndValues ...interface{})

func (*Logger) Infow added in v0.13.0

func (l *Logger) Infow(msg string, keysAndValues ...interface{})

func (*Logger) Sync

func (l *Logger) Sync() error

Sync

func (*Logger) Warnw added in v0.13.0

func (l *Logger) Warnw(msg string, keysAndValues ...interface{})

type LoggerConfig

type LoggerConfig struct {
	Writer  io.Writer
	Level   Level
	Encoder Encoder
}

LoggerConfig defines the configuration parameters for constructing tracee's logger implementation.

func NewDefaultLoggerConfig

func NewDefaultLoggerConfig() LoggerConfig

type LoggerInterface added in v0.14.0

type LoggerInterface interface {
	Debugw(msg string, keyAndValues ...interface{})
	Infow(msg string, keyAndValues ...interface{})
	Warnw(msg string, keyAndValues ...interface{})
	Errorw(msg string, keyAndValues ...interface{})
	Fatalw(msg string, keyAndValues ...interface{})
	Sync() error
}

func NewLogger

func NewLogger(cfg LoggerConfig) LoggerInterface

NewLogger function

type LoggingConfig added in v0.14.0

type LoggingConfig struct {
	Logger        LoggerInterface
	Aggregate     bool
	FlushInterval time.Duration
}

LoggingConfig defines the configuration of the package level logging.

Users importing tracee as a library may choose to construct a tracee flavored logger with NewLogger() or supply their own interface.

Tracee offers aggregation support on top of any logger implementation complying to it's interface.

func NewDefaultLoggingConfig added in v0.14.0

func NewDefaultLoggingConfig() LoggingConfig

Jump to

Keyboard shortcuts

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