github.com/mongodb/grip@v0.0.0-20240213223901-f906268d82b9/interface.go (about) 1 package grip 2 3 import ( 4 "github.com/mongodb/grip/level" 5 "github.com/mongodb/grip/send" 6 ) 7 8 // Journaler describes the public interface of the the Grip 9 // interface. Used to enforce consistency between the grip and logging 10 // packages. 11 type Journaler interface { 12 Name() string 13 SetName(string) 14 15 // Methods to access the underlying message sending backend. 16 GetSender() send.Sender 17 SetSender(send.Sender) error 18 SetLevel(send.LevelInfo) error 19 20 // Send allows you to push a composer which stores its own 21 // priorty (or uses the sender's default priority). 22 Send(interface{}) 23 24 // Specify a log level as an argument rather than a method 25 // name. 26 Log(level.Priority, interface{}) 27 Logf(level.Priority, string, ...interface{}) 28 Logln(level.Priority, ...interface{}) 29 LogWhen(bool, level.Priority, interface{}) 30 31 // Methods for sending messages at specific levels. If you 32 // send a message at a level that is below the threshold, then it is a no-op. 33 34 // Emergency methods have "panic" and "fatal" variants that 35 // call panic or os.Exit(1). It is impossible for "Emergency" 36 // to be below threshold, however, if the message isn't 37 // loggable (e.g. error is nil, or message is empty,) these 38 // methods will not panic/error. 39 EmergencyFatal(interface{}) 40 EmergencyPanic(interface{}) 41 42 // For each level, in addition to a basic logger that takes 43 // strings and message.Composer objects (and tries to do its best 44 // with everythingelse.) there are println and printf 45 // loggers. Each Level also has "When" variants that only log 46 // if the passed condition are true. 47 Emergency(interface{}) 48 Emergencyf(string, ...interface{}) 49 Emergencyln(...interface{}) 50 EmergencyWhen(bool, interface{}) 51 52 Alert(interface{}) 53 Alertf(string, ...interface{}) 54 Alertln(...interface{}) 55 AlertWhen(bool, interface{}) 56 57 Critical(interface{}) 58 Criticalf(string, ...interface{}) 59 Criticalln(...interface{}) 60 CriticalWhen(bool, interface{}) 61 62 Error(interface{}) 63 Errorf(string, ...interface{}) 64 Errorln(...interface{}) 65 ErrorWhen(bool, interface{}) 66 67 Warning(interface{}) 68 Warningf(string, ...interface{}) 69 Warningln(...interface{}) 70 WarningWhen(bool, interface{}) 71 72 Notice(interface{}) 73 Noticef(string, ...interface{}) 74 Noticeln(...interface{}) 75 NoticeWhen(bool, interface{}) 76 77 Info(interface{}) 78 Infof(string, ...interface{}) 79 Infoln(...interface{}) 80 InfoWhen(bool, interface{}) 81 82 Debug(interface{}) 83 Debugf(string, ...interface{}) 84 Debugln(...interface{}) 85 DebugWhen(bool, interface{}) 86 }