Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Convenient to use with client loggers, where we don't need fine-grained info // GetConnection ▶ INFO Getting the connection FORMAT_SHORT = `%{color}%{shortfunc} ▶ %{level} %{color:reset} %{message}` // Same as FORMAT_SHORT but without the color information. // Appropriate for logging to files or on mobile clients. FORMAT_SHORT_COLORLESS = `%{shortfunc} ▶ %{level} %{message}` // Convenient to use with server loggers, where we need more fine-grained info and readable // output (includes color information, useful for console output) // [server][Mon 25.Sep 2017,14:11:041] Start ▶ NOTI emmy server listening for connections on port 7007 FORMAT_LONG = `%{color}[%{module}][%{time:Mon _2.Jan 2006,15:04:005}] %{shortfunc} ▶ %{level} %{color:reset} %{message}` // Same as FORMAT_LONG but without the color information (for files) FORMAT_LONG_COLORLESS = `[%{time:Mon _2.Jan 2006,15:04:005}] %{shortfunc} ▶ %{level} %{message}` )
Some predefined formats for logging output
View Source
const ( DEBUG = "DEBUG" INFO = "INFO" NOTICE = "NOTICE" WARNING = "WARNING" ERROR = "ERROR" CRITICAL = "CRITICAL" OFF = -1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileLogger ¶
type FileLogger struct {
// contains filtered or unexported fields
}
FileLogger outputs logs to a given file.
func NewFileLogger ¶
func NewFileLogger(module, logFilePath, logLevel, format string) (*FileLogger, error)
type Logger ¶
type Logger interface { // This function is our own SetLevel(level string) error // These are functions hooked on go-logging's Logger struct Debug(args ...interface{}) Debugf(format string, args ...interface{}) Info(args ...interface{}) Infof(format string, args ...interface{}) Notice(args ...interface{}) Noticef(format string, args ...interface{}) Warning(args ...interface{}) Warningf(format string, args ...interface{}) Error(args ...interface{}) Errorf(format string, args ...interface{}) Critical(args ...interface{}) Criticalf(format string, args ...interface{}) }
Logger is a convenience interface that makes use of all functionality from go-logging's Logger struct. In addition, it defines Disable() and SetLevel(level) functions
type NullLogger ¶
type NullLogger struct {
// contains filtered or unexported fields
}
NullLogger suppresses logging output
func NewNullLogger ¶
func NewNullLogger() *NullLogger
type StdoutFileLogger ¶
type StdoutFileLogger struct {
// contains filtered or unexported fields
}
StdoutFileLogger outputs logs both to standard output as well as to a given file.
func NewStdoutFileLogger ¶
func NewStdoutFileLogger(module, logFilePath, logLevel, formatStdout, formatFile string) (*StdoutFileLogger, error)
type StdoutLogger ¶
type StdoutLogger struct {
// contains filtered or unexported fields
}
StdoutLogger outputs logs to standard output.
func NewStdoutLogger ¶
func NewStdoutLogger(module, logLevel, format string) (*StdoutLogger, error)
Click to show internal directories.
Click to hide internal directories.