Documentation ¶
Index ¶
- Constants
- func AddConsoleHook() error
- func AddFileHook() error
- func AddHook(hook log.Hook)
- func CustomCallerPrettyfier(f *runtime.Frame) (string, string)
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Debugln(args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Errorln(args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Fatalln(args ...interface{})
- func GetLevel() log.Level
- func HTTPLogger(inner http.Handler, name string) http.Handler
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Infoln(args ...interface{})
- func InitLogging(logName string, params *LogParams, alsoLogToStderr bool) (err error)
- func IsLevelEnabled(level log.Level) bool
- func IsSensitive(key string) bool
- func MapScrubber(m map[string]string) map[string]string
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func Panicln(args ...interface{})
- func Print(args ...interface{})
- func Printf(format string, args ...interface{})
- func Println(args ...interface{})
- func Scrubber(args []string) []string
- func Trace(args ...interface{})
- func Tracef(format string, args ...interface{})
- func Traceln(args ...interface{})
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- func Warning(args ...interface{})
- func Warningf(format string, args ...interface{})
- func Warningln(args ...interface{})
- func Warnln(args ...interface{})
- func WithContext(ctx context.Context) *log.Entry
- func WithError(err error) *log.Entry
- func WithField(key string, value interface{}) *log.Entry
- func WithFields(fields Fields) *log.Entry
- func WithTime(t time.Time) *log.Entry
- type ConsoleHook
- type Fields
- type FileHook
- type LogParams
Constants ¶
const ( DefaultLogLevel = "info" DefaultLogFormat = TextFormat DefaultMaxLogFiles = 10 MaxFilesLimit = 20 DefaultMaxLogSize = 100 // in MB MaxLogSizeLimit = 1024 // in MB JsonFormat = "json" TextFormat = "text" )
Variables ¶
This section is empty.
Functions ¶
func AddConsoleHook ¶
func AddConsoleHook() error
func AddFileHook ¶
func AddFileHook() error
func Debug ¶
func Debug(args ...interface{})
Debug logs a message at level Debug on the standard logger.
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf logs a message at level Debug on the standard logger.
func Debugln ¶
func Debugln(args ...interface{})
Debugln logs a message at level Debug on the standard logger.
func Error ¶
func Error(args ...interface{})
Error logs a message at level Error on the standard logger.
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf logs a message at level Error on the standard logger.
func Errorln ¶
func Errorln(args ...interface{})
Errorln logs a message at level Error on the standard logger.
func Fatal ¶
func Fatal(args ...interface{})
Fatal logs a message at level Fatal on the standard logger then the process will exit with status set to 1.
func Fatalf ¶
func Fatalf(format string, args ...interface{})
Fatalf logs a message at level Fatal on the standard logger then the process will exit with status set to 1.
func Fatalln ¶
func Fatalln(args ...interface{})
Fatalln logs a message at level Fatal on the standard logger then the process will exit with status set to 1.
func HTTPLogger ¶
HTTPLogger : wrapper for http logging
func Info ¶
func Info(args ...interface{})
Info logs a message at level Info on the standard logger.
func Infof ¶
func Infof(format string, args ...interface{})
Infof logs a message at level Info on the standard logger.
func Infoln ¶
func Infoln(args ...interface{})
Infoln logs a message at level Info on the standard logger.
func InitLogging ¶
Initialize logging with given params
func IsLevelEnabled ¶
IsLevelEnabled checks if the log level of the standard logger is greater than the level param
func IsSensitive ¶
IsSensitive checks if the given key exists in the list of bad words (sensitive info)
func MapScrubber ¶
MapScrubber checks if the map contains any sensitive information like username/password/secret If found, then masks values for those keys, else copies the original value and returns new map
func Panic ¶
func Panic(args ...interface{})
Panic logs a message at level Panic on the standard logger.
func Panicf ¶
func Panicf(format string, args ...interface{})
Panicf logs a message at level Panic on the standard logger.
func Panicln ¶
func Panicln(args ...interface{})
Panicln logs a message at level Panic on the standard logger.
func Print ¶
func Print(args ...interface{})
Print logs a message at level Info on the standard logger.
func Printf ¶
func Printf(format string, args ...interface{})
Printf logs a message at level Info on the standard logger.
func Println ¶
func Println(args ...interface{})
Println logs a message at level Info on the standard logger.
func Scrubber ¶
Scrubber checks if the args list contains any sensitive information like username/password/secret If found, then returns masked string list, else returns the original input list unmodified.
func Trace ¶
func Trace(args ...interface{})
Trace logs a message at level Trace on the standard logger.
func Tracef ¶
func Tracef(format string, args ...interface{})
Tracef logs a message at level Trace on the standard logger.
func Traceln ¶
func Traceln(args ...interface{})
Traceln logs a message at level Trace on the standard logger.
func Warn ¶
func Warn(args ...interface{})
Warn logs a message at level Warn on the standard logger.
func Warnf ¶
func Warnf(format string, args ...interface{})
Warnf logs a message at level Warn on the standard logger.
func Warning ¶
func Warning(args ...interface{})
Warning logs a message at level Warn on the standard logger.
func Warningf ¶
func Warningf(format string, args ...interface{})
Warningf logs a message at level Warn on the standard logger.
func Warningln ¶
func Warningln(args ...interface{})
Warningln logs a message at level Warn on the standard logger.
func Warnln ¶
func Warnln(args ...interface{})
Warnln logs a message at level Warn on the standard logger.
func WithContext ¶
WithContext creates an entry from the standard logger and adds a context to it.
func WithError ¶
WithError creates an entry from the standard logger and adds an error to it, using the value defined in ErrorKey as key.
func WithField ¶
WithField creates an entry from the standard logger and adds a field to it. If you want multiple fields, use `WithFields`.
Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.
func WithFields ¶
WithFields creates an entry from the standard logger and adds multiple fields to it. This is simply a helper for `WithField`, invoking it once for each field.
Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.
Types ¶
type ConsoleHook ¶
type ConsoleHook struct {
// contains filtered or unexported fields
}
ConsoleHook sends log entries to stdout.
func NewConsoleHook ¶
func NewConsoleHook() *ConsoleHook
NewConsoleHook creates a new log hook for writing to stdout/stderr.
func (*ConsoleHook) Levels ¶
func (hook *ConsoleHook) Levels() []log.Level
type FileHook ¶
type FileHook struct {
// contains filtered or unexported fields
}
FileHook sends log entries to a file.
func NewFileHook ¶
NewFileHook creates a new log hook for writing to a file.
func (*FileHook) GetLocation ¶
type LogParams ¶
LogParams to configure logging