logger

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TRACEE_LOGGER_LVL       = "TRACEE_LOGGER_LVL"
	TRACEE_LOGGER_ENCODER   = "TRACEE_LOGGER_ENCODER"
	TRACEE_LOGGER_AGGREGATE = "TRACEE_LOGGER_AGGREGATE"
)

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 Debug

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

func Error

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

func Fatal

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

func Info

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

func Init

func Init(cfg *LoggerConfig)

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

func IsSetFromEnv

func IsSetFromEnv() bool

func SetBase

func SetBase(l *Logger)

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

func Warn

func Warn(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 LogCounter

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

func (*LogCounter) Dump

func (lc *LogCounter) Dump() map[LogOrigin]uint32

func (*LogCounter) Lookup

func (lc *LogCounter) Lookup(key LogOrigin) (count uint32, found bool)

type LogOrigin

type LogOrigin struct {
	File string
	Line int
}

type Logger

type Logger struct {
	LogCount *LogCounter // updated only on debug level and cfg.Aggregate == true
	// contains filtered or unexported fields
}

Logger struct

func Base

func Base() *Logger

Base returns the package-level base logger

func NewLogger

func NewLogger(cfg *LoggerConfig) *Logger

NewLogger function

func (*Logger) Debug

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

func (*Logger) Error

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

func (*Logger) Fatal

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

func (*Logger) Info

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

func (*Logger) Sync

func (l *Logger) Sync() error

Sync

func (*Logger) Warn

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

type LoggerConfig

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

func NewDefaultLoggerConfig

func NewDefaultLoggerConfig() *LoggerConfig

Jump to

Keyboard shortcuts

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