metric

package
v1.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelFieldName = "level"
)

Variables

View Source
var Component = &app.Component{
	Dependencies: app.Components{
		logger.Component,
	},
	Run: func(c container.Container) error {
		appConfig, err := container.Get[*app.Config](c)
		if err != nil {
			return err
		}

		l, err := container.Get[*logrus.Logger](c)
		if err != nil {
			return err
		}

		l.AddHook(NewCounterHook(appConfig, logrus.ErrorLevel, logrus.WarnLevel))
		l.Info("logger: add hook metric")

		return nil
	},
}

Functions

This section is empty.

Types

type CounterHook

type CounterHook struct {
	// contains filtered or unexported fields
}

func NewCounterHook

func NewCounterHook(appConfig *app.Config, levels ...logrus.Level) *CounterHook

func (*CounterHook) Fire

func (hook *CounterHook) Fire(entry *logrus.Entry) error

func (*CounterHook) Levels

func (hook *CounterHook) Levels() []logrus.Level

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL