Documentation ¶
Index ¶
- Constants
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Init(name string, options ...Option)
- func NewLogger(name string, options ...Option) *logger
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- type LogLevel
- type Logger
- type Option
Constants ¶
View Source
const ( // LogTypeLog is normal log type. LogTypeLog = "log" // LogTypeRequest is Request log type. LogTypeRequest = "request" )
Variables ¶
This section is empty.
Functions ¶
func Fatal ¶
func Fatal(args ...interface{})
Fatal logs a message at level Fatal then the process will exit with status set to 1.
Types ¶
type LogLevel ¶
type LogLevel string
LogLevel is Logger Level type.
const ( // DebugLevel has verbose message. DebugLevel LogLevel = "debug" // InfoLevel is default log level. InfoLevel LogLevel = "info" // WarnLevel is for logging messages about possible issues. WarnLevel LogLevel = "warn" // ErrorLevel is for logging errors. ErrorLevel LogLevel = "error" // FatalLevel is for logging fatal messages. The system shuts down after logging the message. FatalLevel LogLevel = "fatal" // UndefinedLevel is for undefined log level. UndefinedLevel LogLevel = "undefined" )
type Logger ¶
type Logger interface { // Info logs a message at level Info. Info(args ...interface{}) // Infof logs a message at level Info. Infof(format string, args ...interface{}) // Debug logs a message at level Debug. Debug(args ...interface{}) // Debugf logs a message at level Debug. Debugf(format string, args ...interface{}) // Warn logs a message at level Warn. Warn(args ...interface{}) // Warnf logs a message at level Warn. Warnf(format string, args ...interface{}) // Error logs a message at level Error. Error(args ...interface{}) // Errorf logs a message at level Error. Errorf(format string, args ...interface{}) // Fatal logs a message at level Fatal then the process will exit with status set to 1. Fatal(args ...interface{}) // Fatalf logs a message at level Fatal then the process will exit with status set to 1. Fatalf(format string, args ...interface{}) }
Logger includes the logging api sets.
type Option ¶
type Option func(l *logger) error
Option defines the sets of option for logging.
func WithOutputFormat ¶
WithOutputLevel sets the log output format.
func WithOutputLevel ¶
WithOutputLevel sets the log output level.
func WithOutputLevelString ¶
WithOutputLevelString sets the log output level by string.
Click to show internal directories.
Click to hide internal directories.