MCPcopy
hub / github.com/sirupsen/logrus / Logger

Struct Logger

logger.go:17–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15type LogFunction func() []interface{}
16
17type Logger struct {
18 // The logs are `io.Copy`'d to this in a mutex. It's common to set this to a
19 // file, or leave it default which is `os.Stderr`. You can also set this to
20 // something more adventurous, such as logging to Kafka.
21 Out io.Writer
22 // Hooks for the logger instance. These allow firing events based on logging
23 // levels and log entries. For example, to send errors to an error tracking
24 // service, log to StatsD or dump the core on fatal errors.
25 Hooks LevelHooks
26 // All log entries pass through the formatter before logged to Out. The
27 // included formatters are `TextFormatter` and `JSONFormatter` for which
28 // TextFormatter is the default. In development (when a TTY is attached) it
29 // logs with colors, but to a file it wouldn't. You can easily implement your
30 // own that implements the `Formatter` interface, see the `README` or included
31 // formatters for examples.
32 Formatter Formatter
33
34 // Flag for whether to log caller info (off by default)
35 ReportCaller bool
36
37 // The logging level the logger should log at. This is typically (and defaults
38 // to) `logrus.Info`, which allows Info(), Warn(), Error() and Fatal() to be
39 // logged.
40 Level Level
41 // Used to sync writing to the log. Locking is enabled by Default
42 mu MutexWrap
43 // Reusable empty entry
44 entryPool sync.Pool
45 // Function to exit the application, defaults to `os.Exit()`
46 ExitFunc exitFunc
47 // The buffer pool used to format the log. If it is nil, the default global
48 // buffer pool will be used.
49 BufferPool BufferPool
50}
51
52type exitFunc func(int)
53

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected