Documentation ¶
Overview ¶
Package lager is the package for lager
Index ¶
- Constants
- Variables
- func CopyFile(srcFile, dstFile string) error
- func EscapPath(msg string) string
- func FilterFileList(path, pat string) ([]string, error)
- func Init(option *Options)
- func LogRotate(path string, MaxFileSize int, MaxBackupCount int)
- func NewLog(option *Options) (lager.Logger, error)
- type Options
- type RotateConfig
Constants ¶
View Source
const ( LogRotateDate = 1 LogRotateSize = 10 LogBackupCount = 7 RollingPolicySize = "size" )
constant values for logrotate parameters
View Source
const ( LevelDebug = "DEBUG" LevelInfo = "INFO" LevelWarn = "WARN" LevelError = "ERROR" LevelFatal = "FATAL" )
log level
View Source
const ( Stdout = "stdout" Stderr = "stderr" File = "file" )
output type
Variables ¶
View Source
var Logger lager.Logger
Logger is the global variable for the object of lager.Logger Deprecated. plz use openlogging instead
View Source
var Rotators = &rotators{ logFilePaths: make(map[string]*RotateConfig, 5), }
Rotators global rotate instance
Functions ¶
func FilterFileList ¶
FilterFileList function for filter file list path : where the file will be filtered pat : regexp pattern to filter the matched file
func Init ¶ added in v1.7.2
func Init(option *Options)
Init Build constructs a *Lager.Logger with the configured parameters.
Types ¶
type Options ¶ added in v1.7.2
type Options struct { Writers string `yaml:"writers"` LoggerLevel string `yaml:"logger_level"` LoggerFile string `yaml:"logger_file"` LogFormatText bool `yaml:"log_format_text"` RollingPolicy string `yaml:"rollingPolicy"` LogRotateDate int `yaml:"log_rotate_date"` LogRotateSize int `yaml:"log_rotate_size"` LogBackupCount int `yaml:"log_backup_count"` AccessLogFile string `yaml:"access_log_file"` }
Options is the struct for lager information(lager.yaml)
type RotateConfig ¶ added in v1.8.2
type RotateConfig struct { Policy string Size int BackupCount int CheckCycle time.Duration RotateDate int // contains filtered or unexported fields }
RotateConfig rotate config
func NewRotateConfig ¶ added in v1.8.2
func NewRotateConfig(option *Options) *RotateConfig
NewRotateConfig return config
Click to show internal directories.
Click to hide internal directories.