mlog

package
v0.0.0-...-28c053e Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CONSTANTS = loggerConstants{
	ZEROLOG: "zerolog",
	LEVELS: loggerLevels{
		PANIC: "panic",
		FATAL: "fatal",
		ERROR: "error",
		WARN:  "warn",
		INFO:  "info",
		DEBUG: "debug",
		TRACE: "trace",
	},
}

Functions

func Init

func Init(cfg Config, errorStackMarsheler ErrorStackMarshaler, additionnalWriters ...io.Writer) zerolog.Logger

Initializes the zerolog logger using the configuration. The logger is globally set with Logger and with zerolog/log.Logger.

func LogErrors

func LogErrors(event *zerolog.Event, errs []error)

Logs an array of errors on the same message

Types

type Config

type Config struct {
	Code              string     `yaml:"code"`
	Level             string     `yaml:"level"`
	EnableCaller      bool       `yaml:"enableCaller"`
	EnablePrettyPrint bool       `yaml:"enablePrettyPrint"`
	SampleRate        uint       `yaml:"sampleRate"`
	FileConfig        FileConfig `yaml:"fileConfig"`
}

type ErrorStackMarshaler

type ErrorStackMarshaler = func(err error) interface{}

type FileConfig

type FileConfig struct {
	Enabled      bool   `json:"enabled"`
	Directory    string `yaml:"directory"`
	Filename     string `yaml:"filename"`
	MaxSizeInMb  int    `yaml:"maxSizeInMb"`
	MaxBackups   int    `yaml:"maxBackups"`
	MaxAgeInDays int    `yaml:"maxAgeInDays"`
}

Jump to

Keyboard shortcuts

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