-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathinterface.go
More file actions
88 lines (72 loc) · 3.07 KB
/
interface.go
File metadata and controls
88 lines (72 loc) · 3.07 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package grip
import (
"context"
"github.com/mongodb/grip/level"
"github.com/mongodb/grip/send"
)
// Journaler describes the public interface of the the Grip
// interface. Used to enforce consistency between the grip and logging
// packages.
type Journaler interface {
Name() string
SetName(string)
// Methods to access the underlying message sending backend.
GetSender() send.Sender
SetSender(send.Sender) error
SetLevel(send.LevelInfo) error
// Send allows you to push a composer which stores its own
// priorty (or uses the sender's default priority).
Send(context.Context, interface{})
// Specify a log level as an argument rather than a method
// name.
Log(context.Context, level.Priority, interface{})
Logf(context.Context, level.Priority, string, ...interface{})
Logln(context.Context, level.Priority, ...interface{})
LogWhen(context.Context, bool, level.Priority, interface{})
// Methods for sending messages at specific levels. If you
// send a message at a level that is below the threshold, then it is a no-op.
// Emergency methods have "panic" and "fatal" variants that
// call panic or os.Exit(1). It is impossible for "Emergency"
// to be below threshold, however, if the message isn't
// loggable (e.g. error is nil, or message is empty,) these
// methods will not panic/error.
EmergencyFatal(context.Context, interface{})
EmergencyPanic(context.Context, interface{})
// For each level, in addition to a basic logger that takes
// strings and message.Composer objects (and tries to do its best
// with everythingelse.) there are println and printf
// loggers. Each Level also has "When" variants that only log
// if the passed condition are true.
Emergency(context.Context, interface{})
Emergencyf(context.Context, string, ...interface{})
Emergencyln(context.Context, ...interface{})
EmergencyWhen(context.Context, bool, interface{})
Alert(context.Context, interface{})
Alertf(context.Context, string, ...interface{})
Alertln(context.Context, ...interface{})
AlertWhen(context.Context, bool, interface{})
Critical(context.Context, interface{})
Criticalf(context.Context, string, ...interface{})
Criticalln(context.Context, ...interface{})
CriticalWhen(context.Context, bool, interface{})
Error(context.Context, interface{})
Errorf(context.Context, string, ...interface{})
Errorln(context.Context, ...interface{})
ErrorWhen(context.Context, bool, interface{})
Warning(context.Context, interface{})
Warningf(context.Context, string, ...interface{})
Warningln(context.Context, ...interface{})
WarningWhen(context.Context, bool, interface{})
Notice(context.Context, interface{})
Noticef(context.Context, string, ...interface{})
Noticeln(context.Context, ...interface{})
NoticeWhen(context.Context, bool, interface{})
Info(context.Context, interface{})
Infof(context.Context, string, ...interface{})
Infoln(context.Context, ...interface{})
InfoWhen(context.Context, bool, interface{})
Debug(context.Context, interface{})
Debugf(context.Context, string, ...interface{})
Debugln(context.Context, ...interface{})
DebugWhen(context.Context, bool, interface{})
}