loggers

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultConsoleWriter = zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.RFC3339}

	EnableConsolColor  = false
	EnableConsolWriter = true
	EnableFileWriter   = true

	NullLogger      *zerolog.Logger
	CoreDebugLogger *zerolog.Logger
)

Functions

func GetLogger

func GetLogger(fn string) (*zerolog.Logger, error)

func NewGlobalLogger

func NewGlobalLogger() *zerolog.Logger

func NewLogger

func NewLogger(c Config) *zerolog.Logger

func ResetCoreDebugLogger

func ResetCoreDebugLogger()

Types

type Config

type Config struct {
	LogLevel           string `json:"log_level" yaml:"log_level"`
	EnableConsolWriter bool   `json:"enable_consol_writer" yaml:"enable_consol_writer"`
	EnableConsolColor  bool   `json:"enable_consol_color" yaml:"enable_consol_color"`
	EnableFileWriter   bool   `json:"enable_file_writer" yaml:"enable_file_writer"`
	FileName           string `json:"file_name,omitempty" yaml:"file_name,omitempty"`
	MaxSizeMB          int    `json:"max_size_mb,omitempty" yaml:"max_size_mb,omitempty"`
	MaxAgeDays         int    `json:"max_age_days,omitempty" yaml:"max_age_days,omitempty"`
	MaxBackups         int    `json:"max_backups,omitempty" yaml:"max_backups,omitempty"`
	UseLocalTime       bool   `json:"use_local_time,omitempty" yaml:"use_local_time,omitempty"`
	Compress           bool   `json:"compress,omitempty" yaml:"compress,omitempty"`
}

func NewConfig

func NewConfig() *Config

func SetGlobalConfig

func SetGlobalConfig(c Config) *Config

type NullWriter

type NullWriter struct{}

func (*NullWriter) Write

func (*NullWriter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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