logging

package
v0.32.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 logging file should be located at /var/logging/service-xyz/service-xyz.logging and will be rolled according to configuration set.

func NewZHcLog

func NewZHcLog(l *zerolog.Logger, name string) hclog.Logger

NewZHcLog Creates hclog.Logger adapter from a zerolog log

func Reconfigure added in v0.23.0

func Reconfigure(originalConfig, updatedConfig Config)

Reconfigure reconfigures the already initialized Logger with new values

Types

type Config

type Config struct {
	// Enable console logging
	ConsoleLoggingEnabled bool `yaml:"enable_console_logging,omitempty" json:"enable_console_logging,omitempty"`
	// Enable Verbose logging
	Verbose bool `yaml:"verbose,omitempty" json:"verbose,omitempty"`
	// EncodeLogsAsJson makes the logging framework logging JSON
	EncodeLogsAsJson bool `yaml:"encode_logs_as_json,omitempty" json:"encode_logs_as_json,omitempty"`
	// FileLoggingEnabled makes the framework logging to a file
	// the fields below can be skipped if this value is false!
	FileLoggingEnabled bool `yaml:"file_logging_enabled,omitempty" json:"file_logging_enabled,omitempty"`
	// Directory to logging to to when file logging is enabled
	Directory string `yaml:"directory,omitempty" json:"directory,omitempty"`
	// Filename is the name of the logfile which will be placed inside the directory
	Filename string `yaml:"filename,omitempty" json:"filename,omitempty"`
	// MaxSize the max size in MB of the logfile before it's rolled
	MaxSize int `yaml:"max_size,omitempty" json:"max_size,omitempty"`
	// MaxBackups the max number of rolled files to keep
	MaxBackups int `yaml:"max_backups,omitempty" json:"max_backups,omitempty"`
	// MaxAge the max age in days to keep a logfile
	MaxAge int `yaml:"max_age,omitempty" json:"max_age,omitempty"`
	// Console logging will be without color, console logging must be enabled first.
	ConsoleNoColor bool `yaml:"console_no_color,omitempty" json:"console_no_color,omitempty"`
	// Unique Identifier of execution
	InstanceId string
	// contains filtered or unexported fields
}

Config for logging

var GlobalConfig Config

GlobalConfig is the global alterable logging config

type Logger added in v0.23.0

type Logger interface {
	// Logf call this method to log regular messages about the
	// operations they perform.
	// Messages logged by this method are usually tagged with an `INFO` log
	// level in common logging libraries.
	Logf(format string, args ...interface{})

	// Errorf call this method to log errors they encounter while
	// sending events to the backend servers.
	// Messages logged by this method are usually tagged with an `ERROR` log
	// level in common logging libraries.
	Errorf(format string, args ...interface{})
}

func NewSimple added in v0.23.0

func NewSimple(l *zerolog.Logger, name string) Logger

NewSimple Creates hclog.Logger adapter from a simpler logger interfaces

type ZerologKVAdapter

type ZerologKVAdapter struct {
	// contains filtered or unexported fields
}

func (ZerologKVAdapter) Debug

func (z ZerologKVAdapter) Debug(msg string, args ...interface{})

func (ZerologKVAdapter) Error

func (z ZerologKVAdapter) Error(msg string, args ...interface{})

func (ZerologKVAdapter) ImpliedArgs

func (ZerologKVAdapter) ImpliedArgs() []interface{}

func (ZerologKVAdapter) Info

func (z ZerologKVAdapter) Info(msg string, args ...interface{})

func (ZerologKVAdapter) IsDebug

func (z ZerologKVAdapter) IsDebug() bool

func (ZerologKVAdapter) IsError

func (z ZerologKVAdapter) IsError() bool

func (ZerologKVAdapter) IsInfo

func (z ZerologKVAdapter) IsInfo() bool

func (ZerologKVAdapter) IsTrace

func (z ZerologKVAdapter) IsTrace() bool

func (ZerologKVAdapter) IsWarn

func (z ZerologKVAdapter) IsWarn() bool

func (ZerologKVAdapter) Log

func (z ZerologKVAdapter) Log(level hclog.Level, msg string, args ...interface{})

func (ZerologKVAdapter) Name

func (z ZerologKVAdapter) Name() string

func (ZerologKVAdapter) Named

func (z ZerologKVAdapter) Named(name string) hclog.Logger

func (ZerologKVAdapter) ResetNamed

func (z ZerologKVAdapter) ResetNamed(name string) hclog.Logger

func (*ZerologKVAdapter) SetLevel

func (z *ZerologKVAdapter) SetLevel(level hclog.Level)

func (ZerologKVAdapter) StandardLogger

func (z ZerologKVAdapter) StandardLogger(opts *hclog.StandardLoggerOptions) *log.Logger

func (ZerologKVAdapter) StandardWriter

func (z ZerologKVAdapter) StandardWriter(opts *hclog.StandardLoggerOptions) io.Writer

func (ZerologKVAdapter) Trace

func (z ZerologKVAdapter) Trace(msg string, args ...interface{})

func (ZerologKVAdapter) Warn

func (z ZerologKVAdapter) Warn(msg string, args ...interface{})

func (ZerologKVAdapter) With

func (z ZerologKVAdapter) With(args ...interface{}) hclog.Logger

type ZerologSimpleLogger added in v0.23.0

type ZerologSimpleLogger struct {
	// contains filtered or unexported fields
}

func (ZerologSimpleLogger) Errorf added in v0.23.0

func (z ZerologSimpleLogger) Errorf(format string, args ...interface{})

func (ZerologSimpleLogger) Logf added in v0.23.0

func (z ZerologSimpleLogger) Logf(format string, args ...interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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