Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrometheusHook ¶
type PrometheusHook struct {
// contains filtered or unexported fields
}
PrometheusHook exposes Prometheus counters for each of logrus' log levels.
func MustNewPrometheusHook ¶ added in v1.1.0
func MustNewPrometheusHook() *PrometheusHook
MustNewPrometheusHook creates a new instance of PrometheusHook which exposes Prometheus counters for various log levels. Contrarily to NewPrometheusHook, it does not return any error to the caller, but panics instead. Use MustNewPrometheusHook if you want a less verbose hook creation. Use NewPrometheusHook if you want more control.
func NewPrometheusHook ¶
func NewPrometheusHook() (*PrometheusHook, error)
NewPrometheusHook creates a new instance of PrometheusHook which exposes Prometheus counters for various log levels. Contrarily to MustNewPrometheusHook, it returns an error to the caller in case of issue. Use NewPrometheusHook if you want more control. Use MustNewPrometheusHook if you want a less verbose hook creation.
func (*PrometheusHook) Fire ¶
func (hook *PrometheusHook) Fire(entry *logrus.Entry) error
Fire increments the appropriate Prometheus counter depending on the entry's log level.
func (*PrometheusHook) Levels ¶
func (hook *PrometheusHook) Levels() []logrus.Level
Levels returns all supported log levels, i.e.: Debug, Info, Warn and Error, as there is no point incrementing a counter just before exiting/panicking.