Source File
hooks.go
Belonging Package
github.com/sirupsen/logrus
package logrus// A hook to be fired when logging on the logging levels returned from// `Levels()` on your implementation of the interface. Note that this is not// fired in a goroutine or a channel with workers, you should handle such// functionality yourself if your call is non-blocking and you don't wish for// the logging calls for levels returned from `Levels()` to block.type Hook interface {Levels() []LevelFire(*Entry) error}// Internal type for storing the hooks on a logger instance.type LevelHooks map[Level][]Hook// Add a hook to an instance of logger. This is called with// `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface.func ( LevelHooks) ( Hook) {for , := range .Levels() {[] = append([], )}}// Fire all the hooks for the passed level. Used by `entry.log` to fire// appropriate hooks for a log entry.func ( LevelHooks) ( Level, *Entry) error {for , := range [] {if := .Fire(); != nil {return}}return nil}
![]() |
The pages are generated with Golds v0.3.6. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |