Documentation ¶
Overview ¶
* Copyright (c) 2020. App Nerds LLC. All rights reserved
* Copyright (c) 2020. App Nerds LLC. All rights reserved
* Copyright (c) 2020. App Nerds LLC. All rights reserved
* Copyright (c) 2020. App Nerds LLC. All rights reserved
* Copyright (c) 2020. App Nerds LLC. All rights reserved
* Copyright (c) 2020. App Nerds LLC. All rights reserved
* Copyright (c) 2020. App Nerds LLC. All rights reserved
Index ¶
- func Hook() echo.MiddlewareFunc
- func HookWithExisting(existingLogger *logrus.Entry) echo.MiddlewareFunc
- func HookWithLogger(existingLogger *logrus.Logger) echo.MiddlewareFunc
- type ILogger
- type JSONLogger
- type LogFormat
- type LogType
- type Logger
- type LogrusMiddleware
- type MiddlewareLogger
- func (l MiddlewareLogger) Debugj(j log.JSON)
- func (l MiddlewareLogger) Errorj(j log.JSON)
- func (l MiddlewareLogger) Fatalj(j log.JSON)
- func (l MiddlewareLogger) Infoj(j log.JSON)
- func (l MiddlewareLogger) Level() log.Lvl
- func (l MiddlewareLogger) Output() io.Writer
- func (l MiddlewareLogger) Panicj(j log.JSON)
- func (l MiddlewareLogger) Prefix() string
- func (l MiddlewareLogger) Printj(j log.JSON)
- func (l MiddlewareLogger) SetLevel(lvl log.Lvl)
- func (l MiddlewareLogger) SetOutput(w io.Writer)
- func (l MiddlewareLogger) SetPrefix(s string)
- func (l MiddlewareLogger) Warnj(j log.JSON)
- type SimpleLogger
- func (logger *SimpleLogger) Debugf(message string, args ...interface{})
- func (logger *SimpleLogger) DisableColors()
- func (logger *SimpleLogger) EnableColors()
- func (logger *SimpleLogger) Errorf(message string, args ...interface{})
- func (logger *SimpleLogger) Infof(message string, args ...interface{})
- type StringLogger
- func (logger *StringLogger) Debugf(message string, args ...interface{})
- func (logger *StringLogger) DisableColors()
- func (logger *StringLogger) EnableColors()
- func (logger *StringLogger) Errorf(message string, args ...interface{})
- func (logger *StringLogger) Infof(message string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Hook ¶
func Hook() echo.MiddlewareFunc
func HookWithExisting ¶
func HookWithExisting(existingLogger *logrus.Entry) echo.MiddlewareFunc
func HookWithLogger ¶
func HookWithLogger(existingLogger *logrus.Logger) echo.MiddlewareFunc
Types ¶
type ILogger ¶
type ILogger interface { Debugf(message string, args ...interface{}) DisableColors() EnableColors() Errorf(message string, args ...interface{}) Infof(message string, args ...interface{}) }
ILogger is an interface that describes how a logger should behave
type JSONLogger ¶
type JSONLogger struct {
Logger
}
JSONLogger is a console logger that has a format of `{"applicationName": "{ApplicationName}", "type": "{Type}"", "message": "{Message}"}`
func NewJSONLogger ¶
func NewJSONLogger(applicationName string, minimumLogLevel LogType) *JSONLogger
NewJSONLogger returns an instance of an ILogger interface set to the JSON logger format
func (*JSONLogger) Debugf ¶
func (logger *JSONLogger) Debugf(message string, args ...interface{})
Debugf writes a formatted debug entry to the log
func (*JSONLogger) DisableColors ¶
func (logger *JSONLogger) DisableColors()
DisableColors turns of console coloring
func (*JSONLogger) EnableColors ¶
func (logger *JSONLogger) EnableColors()
EnableColors turns on console coloring
func (*JSONLogger) Errorf ¶
func (logger *JSONLogger) Errorf(message string, args ...interface{})
Errorf writes a formatted error entry to the log
func (*JSONLogger) Infof ¶
func (logger *JSONLogger) Infof(message string, args ...interface{})
Infof writes a formatted info entry to the log
type LogFormat ¶
type LogFormat int
LogFormat describes how to format log messages
Constants for the available log formats
func StringToLogFormat ¶
StringToLogFormat converts a specified string to a LogFormat. If the string does not match a specific log type the SIMPLE is returned.
type LogType ¶
type LogType int
LogType represents a type and level of logging
Constants for the type and levels of logging
func StringToLogType ¶
StringToLogType converts a specified string to a LogType. If the string does not match a specific log type the NONE is returned.
type Logger ¶
type Logger struct { ApplicationName string LogLevel LogType LogFormat LogFormat // contains filtered or unexported fields }
Logger represents the basic instance of a logging object. Other, more specific loggers will use this
type LogrusMiddleware ¶
type LogrusMiddleware struct {
// contains filtered or unexported fields
}
type MiddlewareLogger ¶
func (MiddlewareLogger) Debugj ¶
func (l MiddlewareLogger) Debugj(j log.JSON)
func (MiddlewareLogger) Errorj ¶
func (l MiddlewareLogger) Errorj(j log.JSON)
func (MiddlewareLogger) Fatalj ¶
func (l MiddlewareLogger) Fatalj(j log.JSON)
func (MiddlewareLogger) Infoj ¶
func (l MiddlewareLogger) Infoj(j log.JSON)
func (MiddlewareLogger) Level ¶
func (l MiddlewareLogger) Level() log.Lvl
func (MiddlewareLogger) Output ¶
func (l MiddlewareLogger) Output() io.Writer
func (MiddlewareLogger) Panicj ¶
func (l MiddlewareLogger) Panicj(j log.JSON)
func (MiddlewareLogger) Prefix ¶
func (l MiddlewareLogger) Prefix() string
func (MiddlewareLogger) Printj ¶
func (l MiddlewareLogger) Printj(j log.JSON)
func (MiddlewareLogger) SetLevel ¶
func (l MiddlewareLogger) SetLevel(lvl log.Lvl)
func (MiddlewareLogger) SetOutput ¶
func (l MiddlewareLogger) SetOutput(w io.Writer)
func (MiddlewareLogger) SetPrefix ¶
func (l MiddlewareLogger) SetPrefix(s string)
func (MiddlewareLogger) Warnj ¶
func (l MiddlewareLogger) Warnj(j log.JSON)
type SimpleLogger ¶
type SimpleLogger struct {
Logger
}
SimpleLogger is a basic console logger that has a format of `{ApplicationName}: {Type} - {Message}`
func NewSimpleLogger ¶
func NewSimpleLogger(applicationName string, minimumLogLevel LogType) *SimpleLogger
NewSimpleLogger returns an instance of an ILogger interface set to the simple logger format
func (*SimpleLogger) Debugf ¶
func (logger *SimpleLogger) Debugf(message string, args ...interface{})
Debugf writes a formatted debug entry to the log
func (*SimpleLogger) DisableColors ¶
func (logger *SimpleLogger) DisableColors()
DisableColors turns of console coloring
func (*SimpleLogger) EnableColors ¶
func (logger *SimpleLogger) EnableColors()
EnableColors turns on console coloring
func (*SimpleLogger) Errorf ¶
func (logger *SimpleLogger) Errorf(message string, args ...interface{})
Errorf writes a formatted error entry to the log
func (*SimpleLogger) Infof ¶
func (logger *SimpleLogger) Infof(message string, args ...interface{})
Infof writes a formatted info entry to the log
type StringLogger ¶
StringLogger is a logger that stores log entries in an array that has a format of `{ApplicationName}: {Type} - {Message}`. This is useful for things like unit tests
func NewStringLogger ¶
func NewStringLogger(applicationName string, minimumLogLevel LogType) *StringLogger
NewStringLogger returns an instance of an ILogger interface set to the simple logger format
func (*StringLogger) Debugf ¶
func (logger *StringLogger) Debugf(message string, args ...interface{})
Debugf writes a formatted debug entry to the log
func (*StringLogger) DisableColors ¶
func (logger *StringLogger) DisableColors()
DisableColors turns of console coloring
func (*StringLogger) EnableColors ¶
func (logger *StringLogger) EnableColors()
EnableColors turns on console coloring
func (*StringLogger) Errorf ¶
func (logger *StringLogger) Errorf(message string, args ...interface{})
Errorf writes a formatted error entry to the log
func (*StringLogger) Infof ¶
func (logger *StringLogger) Infof(message string, args ...interface{})
Infof writes a formatted info entry to the log