-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhandler.go
More file actions
26 lines (22 loc) · 785 Bytes
/
handler.go
File metadata and controls
26 lines (22 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package clog
// Handler for a logger.
//
// The LogEntry method should return an error if the handler didn't manage to save the log
// (file, remote, etc.)
// It's up to the parent handler to take action on the error: the default Logger is always going to ignore it.
type Handler interface {
LogEntry(LogEntry) error
}
// Prefixer is an optional interface on handler that supports prefixing a log message
type Prefixer interface {
SetPrefix(string) Handler
}
// Closer is an optional interface on handler that supports closing its output
type Closer interface {
Close() error
}
// MiddlewareHandler is a Handler that act as a middleware => you can get and set the next handler in the chain
type MiddlewareHandler interface {
GetHandler() Handler
SetHandler(handler Handler)
}