Documentation
¶
Overview ¶
Package flash configures an opinionated zap logger.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger struct {
*zap.SugaredLogger
// contains filtered or unexported fields
}
Logger is the flash logger which embeds a `zap.SugaredLogger`.
func New ¶
New creates a new Logger. If no options are specified, stacktraces and color output are disabled and the confgured level is `InfoLevel`.
func (*Logger) Disable ¶
func (l *Logger) Disable()
Disable disables (nearly) all output. Only `FatalLevel` errors are logged.
type Option ¶
type Option func(c *config)
Option configures zap.Config.
func WithPrometheus ¶
func WithPrometheus(appName string, registry prometheus.Registerer) Option
WithPrometheus registers a prometheus log message counter.
The created metrics are of the form:
<appName>_log_messages_total{level="info"} 4
func WithStacktrace ¶
func WithStacktrace() Option
WithStacktrace completely enables automatic stacktrace capturing. Stacktraces are captured on `ErrorLevel` and above when in debug mode. When not in debug mode, only `FatalLevel` messages contain stacktraces.
func WithoutCaller ¶
func WithoutCaller() Option
WithoutCaller stops annotating logs with the calling function's file name and line number.