logging

package
v0.0.0-...-3f873ad Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeFormat = "15:04:05.000"
)

Logger is the opensvc specific zerolog logger

Variables

View Source
var (
	// WithCaller adds the file:line information of the logger caller
	WithCaller bool
)

Functions

func Configure

func Configure(config Config) error

Configure sets up the logging framework

func SetDefaultConsoleWriter

func SetDefaultConsoleWriter(w zerolog.ConsoleWriter)

SetDefaultConsoleWriter set the default console writer

Types

type Config

type Config struct {
	// WithCaller includes the caller file:line to the records
	WithCaller bool

	// Enable console logging
	WithConsoleLog bool

	// Enable console logging coloring
	WithColor bool

	// LogFile makes the framework log to a file
	LogFile string

	// SessionLogFile logs to a per-sessionid file
	SessionLogFile string

	// Level is the minimum log record level to accept.
	// debug, info, warn[ing], error, fatal, panic
	Level 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
}

Config is the configuration of the zerolog logger and writers

type StdLogger

type StdLogger interface {
	Panic(v ...any)
	Panicln(v ...any)
	Panicf(format string, v ...any)
	Fatal(v ...any)
	Fatalln(v ...any)
	Fatalf(format string, v ...any)
	Print(v ...any)
	Println(v ...any)
	Printf(format string, v ...any)
}

func StandardLogger

func StandardLogger(log zerolog.Logger) StdLogger

Jump to

Keyboard shortcuts

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