@@ -30,31 +30,79 @@ func Root() Logger {
3030// runtime.Caller(2) always refers to the call site in client code.
3131
3232// Trace is a convenient alias for Root().Trace
33+ //
34+ // Log a message at the trace level with context key/value pairs
35+ //
36+ // # Usage
37+ //
38+ // log.Trace("msg")
39+ // log.Trace("msg", "key1", val1)
40+ // log.Trace("msg", "key1", val1, "key2", val2)
3341func Trace (msg string , ctx ... interface {}) {
3442 root .write (msg , LvlTrace , ctx , skipLevel )
3543}
3644
3745// Debug is a convenient alias for Root().Debug
46+ //
47+ // Log a message at the debug level with context key/value pairs
48+ //
49+ // # Usage Examples
50+ //
51+ // log.Debug("msg")
52+ // log.Debug("msg", "key1", val1)
53+ // log.Debug("msg", "key1", val1, "key2", val2)
3854func Debug (msg string , ctx ... interface {}) {
3955 root .write (msg , LvlDebug , ctx , skipLevel )
4056}
4157
4258// Info is a convenient alias for Root().Info
59+ //
60+ // Log a message at the info level with context key/value pairs
61+ //
62+ // # Usage Examples
63+ //
64+ // log.Info("msg")
65+ // log.Info("msg", "key1", val1)
66+ // log.Info("msg", "key1", val1, "key2", val2)
4367func Info (msg string , ctx ... interface {}) {
4468 root .write (msg , LvlInfo , ctx , skipLevel )
4569}
4670
4771// Warn is a convenient alias for Root().Warn
72+ //
73+ // Log a message at the warn level with context key/value pairs
74+ //
75+ // # Usage Examples
76+ //
77+ // log.Warn("msg")
78+ // log.Warn("msg", "key1", val1)
79+ // log.Warn("msg", "key1", val1, "key2", val2)
4880func Warn (msg string , ctx ... interface {}) {
4981 root .write (msg , LvlWarn , ctx , skipLevel )
5082}
5183
5284// Error is a convenient alias for Root().Error
85+ //
86+ // Log a message at the error level with context key/value pairs
87+ //
88+ // # Usage Examples
89+ //
90+ // log.Error("msg")
91+ // log.Error("msg", "key1", val1)
92+ // log.Error("msg", "key1", val1, "key2", val2)
5393func Error (msg string , ctx ... interface {}) {
5494 root .write (msg , LvlError , ctx , skipLevel )
5595}
5696
5797// Crit is a convenient alias for Root().Crit
98+ //
99+ // Log a message at the crit level with context key/value pairs, and then exit.
100+ //
101+ // # Usage Examples
102+ //
103+ // log.Crit("msg")
104+ // log.Crit("msg", "key1", val1)
105+ // log.Crit("msg", "key1", val1, "key2", val2)
58106func Crit (msg string , ctx ... interface {}) {
59107 root .write (msg , LvlCrit , ctx , skipLevel )
60108 os .Exit (1 )
0 commit comments