log

package
v0.0.0-...-c5fcff7 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResetLogFiles

func ResetLogFiles(paths []string, fileSizeMaxMB int, fileSizeKeepKB int, logger *Logger)

ResetLogFiles keeps the last 'LogFileSizeKeepKB' KB of the log file if the size of the log file has exceeded 'LogFileSizeMaxMB' MB within the last 'PollOrchestratorIntervalSuccess' hours.

Types

type Config

type Config struct {
	Level   string `yaml:"level"`
	StdOut  bool   `yaml:"stdout"`
	LogSink string `yaml:"logSink"`
}

Config contains configuration for logging.

type Logger

type Logger struct {
	*zap.Logger
	PIDPath   string
	RemovePID removePIDfunc
}

Logger embeds a zap.Logger instance, and extends its Fatal and Panic methods to first remove the pid file.

func CreateLogger

func CreateLogger(c *zap.Config, pidPath string, removePIDfunc removePIDfunc) (*Logger, error)

CreateLogger creates a zap logger.

func (*Logger) Fatal

func (log *Logger) Fatal(msg string, fields ...zapcore.Field)

Fatal extends the zap Fatal to also remove the PID file.

func (*Logger) Panic

func (log *Logger) Panic(msg string, fields ...zapcore.Field)

Panic extends the zap Panic to also remove the PID file.

Jump to

Keyboard shortcuts

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