Documentation ¶
Index ¶
- Constants
- Variables
- func Debug(msg string, keysAndValues ...interface{})
- func Error(msg string, keysAndValues ...interface{})
- func Fatal(msg string, keysAndValues ...interface{})
- func HasDebugLevel() bool
- func Info(msg string, keysAndValues ...interface{})
- func Init(cfg *LoggerConfig)
- func IsSetFromEnv() bool
- func Log(lvl Level, innerAggregation bool, msg string, keysAndValues ...interface{})
- func SetBase(l *Logger)
- func Warn(msg string, keysAndValues ...interface{})
- type Config
- type Encoder
- type EncoderConfig
- type Level
- type LogCounter
- type LogOrigin
- type Logger
- func (l *Logger) Debug(msg string, keysAndValues ...interface{})
- func (l *Logger) Error(msg string, keysAndValues ...interface{})
- func (l *Logger) Fatal(msg string, keysAndValues ...interface{})
- func (l *Logger) Info(msg string, keysAndValues ...interface{})
- func (l *Logger) Sync() error
- func (l *Logger) Warn(msg string, keysAndValues ...interface{})
- type LoggerConfig
Constants ¶
View Source
const ( DefaultLevel = InfoLevel DefaultFlushInterval = time.Duration(3) * time.Second )
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 HasDebugLevel ¶ added in v0.11.0
func HasDebugLevel() bool
HasDebugLevel returns true if logger has debug level
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 Log ¶ added in v0.11.0
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.
Types ¶
type EncoderConfig ¶
type EncoderConfig = zapcore.EncoderConfig
type 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) Flush ¶ added in v0.11.1
func (lc *LogCounter) Flush() map[LogOrigin]uint32
type Logger ¶
type Logger struct { LogCount *LogCounter // updated only on debug level and cfg.Aggregate == true // contains filtered or unexported fields }
Logger struct
type LoggerConfig ¶
type LoggerConfig struct { Writer io.Writer Level Level Encoder Encoder Aggregate bool FlushInterval time.Duration }
func NewDefaultLoggerConfig ¶
func NewDefaultLoggerConfig() *LoggerConfig
Click to show internal directories.
Click to hide internal directories.