Documentation ¶
Overview ¶
Package lager is the package for lager
Index ¶
- Constants
- Variables
- func CopyFile(srcFile, destFile string) error
- func Debug(action string, data ...lager.Data)
- func Debugf(format string, args ...interface{})
- func Error(action string, err error, data ...lager.Data)
- func Errorf(err error, format string, args ...interface{})
- func EscapPath(msg string) string
- func Fatal(action string, err error, data ...lager.Data)
- func Fatalf(err error, format string, args ...interface{})
- func FilterFileList(path, pat string) ([]string, error)
- func Info(action string, data ...lager.Data)
- func Infof(format string, args ...interface{})
- func InitWithConfig(passLagerDef *PassLagerCfg)
- func InitWithFile(lagerFile string)
- func Initialize(writers, loggerLevel, loggerFile, rollingPolicy string, logFormatText bool, ...)
- func LagerInit(c Config)
- func LogRotate(path string, MaxFileSize int, MaxBackupCount int)
- func NewLogger(component string) lager.Logger
- func NewLoggerExt(component string, appGUID string) lager.Logger
- func RegisterWriter(name string, writer io.Writer)
- func Warn(action string, data ...lager.Data)
- func Warnf(format string, args ...interface{})
- type Config
- type Lager
- type PassLagerCfg
Constants ¶
const ( RollingPolicySize = "size" LogRotateDate = 1 LogRotateSize = 10 LogBackupCount = 7 )
constant values for logrotate parameters
const ( //DEBUG is a constant of string type DEBUG = "DEBUG" INFO = "INFO" WARN = "WARN" ERROR = "ERROR" FATAL = "FATAL" )
Variables ¶
var Logger lager.Logger
Logger is the global variable for the object of lager.Logger
var Writers = make(map[string]io.Writer)
Writers is a map
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 InitWithConfig ¶
func InitWithConfig(passLagerDef *PassLagerCfg)
func InitWithFile ¶
func InitWithFile(lagerFile string)
readPassLagerConfigFile is unmarshal the paas lager configuration file(lager.yaml)
func Initialize ¶
func Initialize(writers, loggerLevel, loggerFile, rollingPolicy string, logFormatText bool, LogRotateDate, LogRotateSize, LogBackupCount int)
Initialize Build constructs a *Lager.Logger with the configured parameters.
func LagerInit ¶
func LagerInit(c Config)
Init is a function which initializes all config struct variables
func LogRotate ¶
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 NewLoggerExt ¶
NewLoggerExt is a function which is used to write new logs
func RegisterWriter ¶
RegisterWriter is used to register a io writer
Types ¶
type Config ¶
type Config struct { LoggerLevel string LoggerFile string Writers []string EnableRsyslog bool RsyslogNetwork string RsyslogAddr string LogFormatText bool }
Config is a struct which stores details for maintaining logs
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig is a function which retuns config object with default configuration
type Lager ¶
type Lager 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"` }
Lager struct for logger parameters
type PassLagerCfg ¶
type PassLagerCfg 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"` }
PassLagerCfg is the struct for lager information(passlager.yaml)
var PassLagerDefinition *PassLagerCfg = DefaultLagerDefinition()
PassLagerDefinition is having the information about loging
func DefaultLagerDefinition ¶
func DefaultLagerDefinition() *PassLagerCfg