logging

package
v0.9.18 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(c *Config) zerolog.Logger

Types

type Config

type Config struct {
	Level string `yaml:"level" default:"info" validate:"oneof=trace debug info error fatal panic" env:"LIBRATE_LOG_LEVEL"`
	// stdout, stderr, file
	Target    string          `yaml:"target" default:"stdout" validate:"required" env:"LIBRATE_LOG_TARGET" example:"/var/log/librate.log"`
	Format    string          `yaml:"format" default:"console" validate:"oneof=json console" env:"LIBRATE_LOG_FMT"`
	Caller    bool            `yaml:"caller" default:"true" env:"LIBRATE_LOG_CALLER"`
	Timestamp TimestampConfig `yaml:"timestamp" mapstructure:"timestamp"`
}

type TimestampConfig

type TimestampConfig struct {
	Enabled bool   `yaml:"enabled" default:"true" env:"LIBRATE_LOG_TS_ENABLED"`
	Format  string `yaml:"format" default:"2006-01-0215:04:05.000Z07:00" env:"LIBRATE_LOG_TS_FORMAT"`
}

Jump to

Keyboard shortcuts

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