log

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugLevel = zerolog.DebugLevel
	InfoLevel  = zerolog.InfoLevel
	WarnLevel  = zerolog.WarnLevel
	ErrorLevel = zerolog.ErrorLevel
	FatalLevel = zerolog.FatalLevel
	PanicLevel = zerolog.PanicLevel
	NoLevel    = zerolog.NoLevel
	Disabled   = zerolog.Disabled
	TraceLevel = zerolog.TraceLevel
)

Variables

View Source
var Ctx = log.Ctx
View Source
var Debug = log.Debug
View Source
var Err = log.Err
View Source
var Error = log.Error
View Source
var Fatal = log.Fatal
View Source
var Hook = log.Hook
View Source
var Info = log.Info
View Source
var Level = log.Level
View Source
var Log = log.Log
View Source
var Output = log.Output
View Source
var Panic = log.Panic
View Source
var Print = log.Print
View Source
var Printf = log.Printf
View Source
var Sample = log.Sample
View Source
var SetGolvalLevel = zerolog.SetGlobalLevel
View Source
var Trace = log.Trace
View Source
var Warn = log.Warn
View Source
var With = log.With
View Source
var WithLevel = log.WithLevel

Functions

func Configure

func Configure(config Config) *zerolog.Logger

Configure sets up the logging framework

In production, the container logs will be collected and file logging should be disabled. However, during development it's nicer to see logs as text and optionally write to a file when debugging problems in the containerized pipeline

The output log file will be located at /var/log/service-xyz/service-xyz.log and will be rolled according to configuration set.

Types

type Config

type Config struct {
	// Enable console logging
	ConsoleLoggingEnabled bool

	// EncodeLogsAsJson makes the log framework log JSON
	EncodeLogsAsJson bool

	// FileLoggingEnabled makes the framework log to a file
	// the fields below can be skipped if this value is false!
	FileLoggingEnabled bool
	// Directory to log to to when filelogging is enabled
	Directory string
	// Filename is the name of the logfile which will be placed inside the directory
	Filename string
	// MaxSize the max size in MB of the logfile before it's rolled
	MaxSize int
	// MaxBackups the max number of rolled files to keep
	MaxBackups int
	// MaxAge the max age in days to keep a logfile
	MaxAge int
	// Level is the minimum level to log
	Level string
}

Config Configuration for logging

Jump to

Keyboard shortcuts

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