Documentation ¶
Index ¶
- Constants
- func DisableLog()
- func FlushLog()
- func SetKeyValue(lm *LogMessage, kv ...*KV)
- func SetLogWriter(writer io.Writer) error
- func UseLogger(newLogger seelog.LoggerInterface)
- type ConsoleLogger
- func (l *ConsoleLogger) ConnectFail(m string, err error, kv ...*KV)
- func (l *ConsoleLogger) Debug(m string, kv ...*KV)
- func (l *ConsoleLogger) Error(m string, err error, kv ...*KV)
- func (l *ConsoleLogger) Event(m string, kv ...*KV)
- func (l *ConsoleLogger) HadPanic(m string, r interface{})
- func (l *ConsoleLogger) Inform(m string, kv ...*KV)
- func (l *ConsoleLogger) Log(m *LogMessage)
- func (l *ConsoleLogger) MarshalFail(m string, obj interface{}, err error)
- func (l *ConsoleLogger) Timeout(m string, err error, kv ...*KV)
- func (l *ConsoleLogger) UnmarshalFail(m string, data []byte, err error)
- func (l *ConsoleLogger) Warn(m string, kv ...*KV)
- func (l *ConsoleLogger) WillPanic(m string, err error, kv ...*KV)
- type KV
- type Kind
- type LogMessage
- type Logger
- type LoggerBasic
- type NoOpLogger
- func (l *NoOpLogger) ConnectFail(m string, err error, kv ...*KV)
- func (l *NoOpLogger) Debug(m string, kv ...*KV)
- func (l *NoOpLogger) Error(m string, err error, kv ...*KV)
- func (l *NoOpLogger) Event(m string, kv ...*KV)
- func (l *NoOpLogger) HadPanic(m string, r interface{})
- func (l *NoOpLogger) Inform(m string, kv ...*KV)
- func (l *NoOpLogger) Log(m *LogMessage)
- func (l *NoOpLogger) MarshalFail(m string, obj interface{}, err error)
- func (l *NoOpLogger) Timeout(m string, err error, kv ...*KV)
- func (l *NoOpLogger) UnmarshalFail(m string, data []byte, err error)
- func (l *NoOpLogger) Warn(m string, kv ...*KV)
- func (l *NoOpLogger) WillPanic(m string, err error, kv ...*KV)
- type RequstLogger
- type StdLogger
- func (l *StdLogger) ConnectFail(m string, err error, kv ...*KV)
- func (l *StdLogger) Debug(m string, kv ...*KV)
- func (l *StdLogger) Error(m string, e error, kv ...*KV)
- func (l *StdLogger) Event(m string, kv ...*KV)
- func (l *StdLogger) HadPanic(m string, r interface{})
- func (l *StdLogger) Inform(m string, kv ...*KV)
- func (l *StdLogger) Log(m *LogMessage)
- func (l *StdLogger) MarshalFail(m string, obj interface{}, err error)
- func (l *StdLogger) Timeout(m string, err error, kv ...*KV)
- func (l *StdLogger) UnmarshalFail(m string, data []byte, err error)
- func (l *StdLogger) Warn(m string, kv ...*KV)
- func (l *StdLogger) WillPanic(m string, err error, kv ...*KV)
Constants ¶
View Source
const ( Error = "error" Warn = "warn" Inform = "inform" Debug = "debug" Timeout = "timeout" Connect = "connect" Event = "event" Marshal = "marshal" Unmarshal = "unmarshal" Panic = "panic" )
Variables ¶
This section is empty.
Functions ¶
func SetKeyValue ¶
func SetKeyValue(lm *LogMessage, kv ...*KV)
func SetLogWriter ¶
SetLogWriter uses a specified io.Writer to output library log. Use this func if you are not using Seelog logging system in your app.
func UseLogger ¶
func UseLogger(newLogger seelog.LoggerInterface)
UseLogger uses a specified seelog.LoggerInterface to output library log. Use this func if you are using Seelog logging system in your app.
Types ¶
type ConsoleLogger ¶
type ConsoleLogger struct { }
func (*ConsoleLogger) ConnectFail ¶
func (l *ConsoleLogger) ConnectFail(m string, err error, kv ...*KV)
func (*ConsoleLogger) Debug ¶
func (l *ConsoleLogger) Debug(m string, kv ...*KV)
func (*ConsoleLogger) Event ¶
func (l *ConsoleLogger) Event(m string, kv ...*KV)
func (*ConsoleLogger) HadPanic ¶
func (l *ConsoleLogger) HadPanic(m string, r interface{})
func (*ConsoleLogger) Inform ¶
func (l *ConsoleLogger) Inform(m string, kv ...*KV)
Infom captures a simple message. If you are logging key value pairs, use Info(m interface{})
func (*ConsoleLogger) Log ¶
func (l *ConsoleLogger) Log(m *LogMessage)
func (*ConsoleLogger) MarshalFail ¶
func (l *ConsoleLogger) MarshalFail(m string, obj interface{}, err error)
func (*ConsoleLogger) UnmarshalFail ¶
func (l *ConsoleLogger) UnmarshalFail(m string, data []byte, err error)
func (*ConsoleLogger) Warn ¶
func (l *ConsoleLogger) Warn(m string, kv ...*KV)
type LogMessage ¶
type Logger ¶
type Logger interface { LoggerBasic // MarshalFail occurs when an object fails to marshal. // Solving a Marshal failure requires discovering which object type and what data was // in that instance that could have caused the failure. This is why the interface requires // the object MarshalFail(m string, obj interface{}, err error) // UnmarshalFail occures when a stream is unable to be unmarshalled. // Solving a unmarshal failure requires knowing what object type, which field, and // what's wrong with the source data that causes the problem UnmarshalFail(m string, data []byte, err error) Timeout(m string, err error, kv ...*KV) ConnectFail(m string, err error, kv ...*KV) }
type LoggerBasic ¶
type LoggerBasic interface { HadPanic(m string, p interface{}) WillPanic(m string, err error, kv ...*KV) Error(m string, err error, kv ...*KV) Warn(m string, kv ...*KV) // Inform captures a simple message. // Inform("Server is starting...") Inform(m string, kv ...*KV) Event(m string, kv ...*KV) Debug(m string, kv ...*KV) Log(m *LogMessage) }
type NoOpLogger ¶
type NoOpLogger struct { }
func NewNoOpLogger ¶
func NewNoOpLogger() *NoOpLogger
func (*NoOpLogger) ConnectFail ¶
func (l *NoOpLogger) ConnectFail(m string, err error, kv ...*KV)
func (*NoOpLogger) Debug ¶
func (l *NoOpLogger) Debug(m string, kv ...*KV)
func (*NoOpLogger) Event ¶
func (l *NoOpLogger) Event(m string, kv ...*KV)
func (*NoOpLogger) HadPanic ¶
func (l *NoOpLogger) HadPanic(m string, r interface{})
func (*NoOpLogger) Inform ¶
func (l *NoOpLogger) Inform(m string, kv ...*KV)
func (*NoOpLogger) Log ¶
func (l *NoOpLogger) Log(m *LogMessage)
func (*NoOpLogger) MarshalFail ¶
func (l *NoOpLogger) MarshalFail(m string, obj interface{}, err error)
func (*NoOpLogger) UnmarshalFail ¶
func (l *NoOpLogger) UnmarshalFail(m string, data []byte, err error)
func (*NoOpLogger) Warn ¶
func (l *NoOpLogger) Warn(m string, kv ...*KV)
type RequstLogger ¶
type StdLogger ¶
type StdLogger struct { }
func (*StdLogger) Event ¶
Info logs key value pairs, typically to JSON. Typically using an anonymous struct:
log.Info(struct{MyKey string}{MyKey:"value to capture"})
func (*StdLogger) Inform ¶
Infom captures a simple message. If you are logging key value pairs, use Info(m interface{})
func (*StdLogger) Log ¶
func (l *StdLogger) Log(m *LogMessage)
func (*StdLogger) MarshalFail ¶
func (*StdLogger) UnmarshalFail ¶
Click to show internal directories.
Click to hide internal directories.