Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Log = NewStdLoggerWithLevel(PanicLevel)
Log is the same as the default standard logger from "log".
Functions ¶
This section is empty.
Types ¶
type Level ¶
type Level int
A Level is a logging priority. Higher levels are more important. This is here as a convenience when using the various log options.
const ( // DebugLevel logs are typically voluminous, // and are usually disabled in production. DebugLevel Level = iota - 1 // InfoLevel is the default logging priority. InfoLevel // WarnLevel logs are more important than Info, // but don't need individual human review. WarnLevel // ErrorLevel logs are high-priority. If an application runs // smoothly, it shouldn't generate any error-level logs. ErrorLevel // PanicLevel logs a message, then panics. PanicLevel // FatalLevel logs a message, then calls os.Exit(1). FatalLevel )
type Logger ¶
type Logger interface { // Debug logs args when the logger level is debug. Debug(v ...interface{}) // Debugf formats args and logs the result when the logger level is debug. Debugf(format string, v ...interface{}) // Info logs args when the logger level is info. Info(args ...interface{}) // Infof formats args and logs the result when the logger level is info. Infof(format string, v ...interface{}) // Warn logs args when the logger level is warn. Warn(v ...interface{}) // Warnf formats args and logs the result when the logger level is warn. Warnf(format string, v ...interface{}) // Error logs args when the logger level is error. Error(v ...interface{}) // Errorf formats args and logs the result when the logger level is debug. Errorf(format string, v ...interface{}) // Panic logs args on panic. Panic(v ...interface{}) // Panicf formats args and logs the result on panic. Panicf(format string, v ...interface{}) // Fatal logs args when the error is fatal. Fatal(v ...interface{}) // Fatalf formats args and logs the result when the error is fatal. Fatalf(format string, v ...interface{}) }
Logger is a generic logger interface.
func Named ¶
Named adds a name string to the logger. How the name is added is logger specific i.e. a logrus field or std logger prefix, etc.
func NewLogrusLoggerWithLevel ¶
NewLogrusLoggerWithLevel returns a new production logrus logger with the log level.
func NewStdLogger ¶
NewStdLogger returns a new standard logger with the log level.
func NewStdLoggerWithLevel ¶
NewStdLoggerWithLevel is a stderr logger with the log level.
func NewZapLoggerWithLevel ¶
NewZapLoggerWithLevel returns a new production zap logger with the log level.
Click to show internal directories.
Click to hide internal directories.