Documentation ¶
Index ¶
- Variables
- 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 Flush() error
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func Register(name string, provider LoggerProvider)
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- type Fields
- type LogLevel
- type Logger
- type LoggerOption
- func WithJSONFormat(jsonFormat bool) LoggerOption
- func WithLevel(level LogLevel) LoggerOption
- func WithOutput(output io.Writer) LoggerOption
- func WithPresets(fields Fields) LoggerOption
- func WithProvider(provider string) LoggerOption
- func WithReplaceDefaultLogger(replace bool) LoggerOption
- func WithRollingFiles(filename string, maxSizeMBs, maxBackups, maxAgeDays int) LoggerOption
- type LoggerOptions
- type LoggerProvider
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Default A global variable so that log functions can be directly accessed Default = Logger(nil) )
Functions ¶
func Register ¶
func Register(name string, provider LoggerProvider)
Register registers a logger provider
Types ¶
type Fields ¶
type Fields map[string]interface{}
Fields Type to pass when we want to call WithFields for structured logging
type LogLevel ¶
type LogLevel string
LogLevel ..
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 sytem shutsdown after logging the message. FatalLevel LogLevel = "fatal" )
type Logger ¶
type Logger interface { Debug(args ...interface{}) Debugf(format string, args ...interface{}) Info(args ...interface{}) Infof(format string, args ...interface{}) Warn(args ...interface{}) Warnf(format string, args ...interface{}) Error(args ...interface{}) Errorf(format string, args ...interface{}) Fatal(args ...interface{}) Fatalf(format string, args ...interface{}) Panic(args ...interface{}) Panicf(format string, args ...interface{}) // WithFields return a logger with fields WithFields(fields Fields) Logger // Flush the log Flush() error }
Logger is our contract for the logger
func NewLogger ¶
func NewLogger(options ...LoggerOption) (Logger, error)
NewLogger converts from xml to json
type LoggerOption ¶
type LoggerOption func(*LoggerOptions) error
LoggerOption ...
func WithReplaceDefaultLogger ¶
func WithReplaceDefaultLogger(replace bool) LoggerOption
WithReplaceDefaultLogger ...
func WithRollingFiles ¶
func WithRollingFiles(filename string, maxSizeMBs, maxBackups, maxAgeDays int) LoggerOption
WithRollingFiles ...
type LoggerOptions ¶
type LoggerOptions struct {
// contains filtered or unexported fields
}
LoggerOptions ...
Click to show internal directories.
Click to hide internal directories.