logex

package
v0.3.2-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(appName string, level zapcore.Level, ec *EncodingConfig) *zap.Logger

Build builds the default zap logger, and sets the global zap logger to the configured logger instance.

func GetLogger added in v0.0.5

func GetLogger(fields ...zap.Field) *zap.Logger

GetLogger returns an instance with some context, expressed as fields

func GetLoggerLevelValue

func GetLoggerLevelValue(loggerLevel string) (zapcore.Level, error)

GetLoggerLevelValue resolves logger level to zap level

func LevelEncoder added in v0.0.13

func LevelEncoder(raw []byte) zapcore.LevelEncoder

LevelEncoder takes a raw string (as []byte) and returnsthe corresponding zapcore.LevelEncoder

func Reset added in v0.3.2

func Reset()

Reset the once init for logger

Types

type EncodingConfig added in v0.0.13

type EncodingConfig struct {
	// Format
	Format string
	// LevelEncoder defines how level is encoded (colors, lowercase, etc.)
	LevelEncoder zapcore.LevelEncoder // lowercase
}

EncodingConfig represents the needed encoding configuration for logger

type Logger added in v0.2.0

type Logger interface {
	// With enables to add more fields to the underlying zap.Logger
	With(fields ...zap.Field) Logger
	// Trace is an additional function that is missing in zap.Logger
	Trace(msg string, fields ...zap.Field)
	// Debug calls the underlying zap.Logger
	Debug(msg string, fields ...zap.Field)
	// Info calls the underlying zap.Logger
	Info(msg string, fields ...zap.Field)
	// Warn calls the underlying zap.Logger
	Warn(msg string, fields ...zap.Field)
	// Error calls the underlying zap.Logger
	Error(msg string, fields ...zap.Field)
	// Fatal calls the underlying zap.Logger
	Fatal(msg string, fields ...zap.Field)
	// Panic calls the underlying zap.Logger
	Panic(msg string, fields ...zap.Field)
}

Logger is the logger interface used across the project it adds custom methods (e.g. Trace) on top of zap.Logger

func NewSSVLogger added in v0.2.0

func NewSSVLogger(base *zap.Logger) Logger

NewSSVLogger creates a new Logger

Jump to

Keyboard shortcuts

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