logutil

package
v0.0.0-...-f3d4632 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2019 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLogger

func InitLogger(cfg *LogConfig) error

InitLogger initializes logger.

Types

type FileLogConfig

type FileLogConfig struct {
	// Log filename, leave empty to disable file log.
	Filename string `toml:"filename"`
	// Is log compress enabled.
	LogCompress bool `toml:"log-compress"`
	// Max size for a single file, in MB.
	MaxSize int `toml:"max-size"`
	// Max log keep days.
	MaxDays int `toml:"max-days"`
	// Maximum number of old log files to retain.
	MaxBackups int `toml:"max-backups"`
}

FileLogConfig serializes file log related config in toml.

type LogConfig

type LogConfig struct {
	// Log level.
	Level string `toml:"level"`
	// Log format, json, text or console.
	Format string `toml:"format"`
	// Disable automatic timestamps in output.
	DisableTimestamp bool `toml:"disable-timestamp"`
	// File log config.
	File FileLogConfig `toml:"file"`
}

LogConfig serializes log related config in toml.

Jump to

Keyboard shortcuts

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