-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterfaces.go
More file actions
33 lines (28 loc) · 948 Bytes
/
interfaces.go
File metadata and controls
33 lines (28 loc) · 948 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
27
28
29
30
31
32
33
package logus
import "context"
// LogEntry hold data to be logged
type LogEntry struct {
Severity Severity
Component string
MessageFormat string
MessageArgs []any
Payload any
}
// Logger defines logs dispatcher
type Logger interface {
Log(ctx context.Context, entry LogEntry)
}
type SimpleLogger interface {
Debugf(ctx context.Context, format string, args ...any)
Defaultf(ctx context.Context, format string, args ...any)
Infof(ctx context.Context, format string, args ...any)
Noticef(ctx context.Context, format string, args ...any)
Errorf(ctx context.Context, format string, args ...any)
Warningf(ctx context.Context, format string, args ...any)
Criticalf(ctx context.Context, format string, args ...any)
Alertf(ctx context.Context, format string, args ...any)
}
// LogEntryHandler should implement persistence of logs entries
type LogEntryHandler interface {
Log(ctx context.Context, entry LogEntry) error
}