logging

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2020 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// LogLevelEnvStr - environment variable for the setting the log level
	LogLevelEnvStr string = "PUREPORT_LOG_LEVEL"

	// LogFileEnvStr - environment variable for the location of the log file
	LogFileEnvStr string = "PUREPORT_LOG_FILE"

	// LogDisableColorStr - environment variable to disable color log output
	LogDisableColorStr string = "PUREPORT_LOG_NOCOLOR"
)

Variables

This section is empty.

Functions

func SetupLogger

func SetupLogger(logConfig *LogConfig)

SetupLogger configures the system logger based on the specified log configuration. Environment variables can override these values.

Types

type LogConfig

type LogConfig struct {
	Level       string `desc:"One of the available log log-levels- (info, debug, error, warn)"`
	Location    string `desc:"stdout, stderr, or the path to a file"`
	MaxSize     int    `desc:"Maximum size (in MB) of the log file before it gets rotated, default=10"`
	MaxBackups  int    `desc:"Maximum number of old log files to retain, default=2"`
	MaxAge      int    `desc:"Maximum number of days to retain old log files, default=1"`
	EnableColor bool   `desc:"Enable color log output"`
}

LogConfig contains setting for configuring the logger

func NewLogConfig

func NewLogConfig() *LogConfig

NewLogConfig generate a new default logging configuration

Jump to

Keyboard shortcuts

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