lager

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: Apache-2.0 Imports: 15 Imported by: 23

Documentation

Overview

Package lager is the package for lager

Index

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 CopyFile

func CopyFile(srcFile, dstFile string) error

CopyFile copy file

func EscapPath

func EscapPath(msg string) string

EscapPath escape path

func FilterFileList

func FilterFileList(path, pat string) ([]string, error)

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.

func LogRotate

func LogRotate(path string, MaxFileSize int, MaxBackupCount int)

LogRotate function for log rotate path: where log files need rollover MaxFileSize: MaxSize of a file before rotate. By M Bytes. MaxBackupCount: Max counts to keep of a log's backup files.

func NewLog added in v1.8.2

func NewLog(option *Options) (lager.Logger, error)

NewLog returns a logger

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

Jump to

Keyboard shortcuts

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