Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ShortCallerPrettyfier = func(f *runtime.Frame) (function string, file string) { funcname := path.Ext(f.Function) filename := path.Base(f.File) return fmt.Sprintf("%s()", funcname), fmt.Sprintf("%s:%d", filename, f.Line) }
ShortCallerPrettyfier modify the content of the function and file keys in the data when ReportCaller is activated. INFO[0000] main.go:23 main() hello world
Functions ¶
func WithReporterCaller ¶ added in v0.0.54
func WithReporterCaller(log *logrus.Logger, callerPrettyfier func(*runtime.Frame) (function string, file string))
WithReporterCaller enhances logrus log to log caller info callerPrettyfier is defined in logrus.TextFormatter and logrus.JSONFormatter. callerPrettyfier affects only if formatter is logrus.TextFormatter and logrus.JSONFormatter. if callerPrettyfier not set, ShortCallerPrettyfier is set
func WithRotation ¶
func WithRotation(log *logrus.Logger, path string, duration time.Duration, maxCount uint, maxAge time.Duration) error
WithRotation enhances logrus log to be written to local filesystem, with file rotation path sets log's base path prefix duration sets the time between rotation. maxCount sets the number of files should be kept before it gets purged from the file system. maxAge sets the max age of a log file before it gets purged from the file system.
Types ¶
type FieldLogger ¶
type FieldLogger struct {
// contains filtered or unexported fields
}
func New ¶
func New(l logrus.FieldLogger) *FieldLogger
func (*FieldLogger) GetLogger ¶
func (b *FieldLogger) GetLogger() logrus.FieldLogger
func (*FieldLogger) GetStdLogger ¶
func (b *FieldLogger) GetStdLogger() *log.Logger
func (*FieldLogger) SetLogger ¶
func (b *FieldLogger) SetLogger(l logrus.FieldLogger)
func (*FieldLogger) SetStdLogger ¶
func (b *FieldLogger) SetStdLogger(l *log.Logger)