Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OptLog ¶
type OptLog struct {
//time format for screen log
StdoutTimeFormat string
//time format for log file
LogFileTimeFormat string
//path for all logs
LogPath string
//example prefix 'access' in access.log.20230105
FileNamePrefix string
//example suffix '%Y%m%d' for '20230105' in access.log.20230105
FileNameSuffixTimeFormat string
//error level log will be saved in seperated error.log for keeping more time if it's ture
SetErrFileHook bool
//keep log count
KeepCount int
//log level
LogLevel logrus.Level
//logFile
//MapLogFile map[string]string
//error log prefix error.log if SetErrFileHook is true
ErrLogPrefix string
//error log suffix "%Y%m" if SetErrFileHook is true
ErrLogSuffix string
}
func (*OptLog) ConfigLogrus ¶
ConfigLogrus
- @msg to configure logrus with
- 1. log format with color, timestamp
- 2. log redirect by loglevel
- 3. create file link for alive log
- 4. set log keeping count
- @receiver opt
- @return: *logrus.Logger
- @return: error
Click to show internal directories.
Click to hide internal directories.