Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileRotationLogHook ¶
type FileRotationLogHook struct {
// contains filtered or unexported fields
}
FileRotationLogHook stores the configuration of the hook
func NewFileRotationLogHook ¶
func NewFileRotationLogHook(fileName string, opts ...Option) *FileRotationLogHook
NewFileRotationLogHook creates a new FileRotationLogHook*/
func (*FileRotationLogHook) Fire ¶
func (hook *FileRotationLogHook) Fire(entry *logrus.Entry) error
Fire is called when a log event is fired.
func (*FileRotationLogHook) Levels ¶
func (hook *FileRotationLogHook) Levels() []logrus.Level
Levels returns the available logging levels
type FileRotationOption ¶
type FileRotationOption struct { FileName string MaxSize int MaxAge int MaxBackups int LocalTime bool Compress bool }
FileRotationOption provides all parameters for file rotation
type Option ¶
type Option func(*FileRotationOption)
func EnableCompression ¶
func EnableCompression() Option
EnableCompression is to enable old log file gzip compression. Defaults to false.
func EnableLocalTime ¶
func EnableLocalTime() Option
EnableLocalTime is to determine if the time used for formatting the timestamps in backup files is the computer's local time. The default is to use UTC time.
func WithMaxAge ¶
WithMaxAge provides way to adjust max age (in days). The default is not to remove old log files based on age.
func WithMaxBackups ¶
WithMaxBackups provides way to adjust max number of backups. Defaults to retain all old log files though MaxAge may still cause them to get deleted.
func WithMaxSize ¶
WithMaxSize provides way to adjust maxSize (in MBs). Defaults to 100 MBs.