Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultLogTimeFormat = "2006-01-02 15:04:05.000"
DefaultLogTimeFormat defines the timestamp format.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConsoleHook ¶
type ConsoleHook struct {
// contains filtered or unexported fields
}
ConsoleHook shows logs on console.
func (*ConsoleHook) Fire ¶
func (ch *ConsoleHook) Fire(entry *logrus.Entry) error
Fire implements Hook#Fire.
func (*ConsoleHook) Levels ¶
func (ch *ConsoleHook) Levels() []logrus.Level
Levels implements Hook#Levels().
type DragonflyFormatter ¶
type DragonflyFormatter struct { // TimestampFormat sets the format used for marshaling timestamps. TimestampFormat string Sign string }
DragonflyFormatter customizes the dragonfly log format.
type Option ¶ added in v1.0.0
Option is a functional configuration for the given logrus logger.
func WithConsole ¶ added in v1.0.0
func WithConsole() Option
WithConsole adds a hook to output logs to stdout.
func WithLogFile ¶ added in v1.0.0
WithLogFile sets the logger to output to the given file, with log rotation. If the given file is empty, nothing will be done.
func WithMaxSizeMB ¶ added in v1.0.0
WithMaxSizeMB sets the max size of log files in MB. If the logger is not configured to use a log file, an error is returned.
Click to show internal directories.
Click to hide internal directories.