Documentation ¶
Index ¶
- func Debug(args ...interface{})
- func Error(args ...interface{})
- func Fatal(args ...interface{})
- func Info(args ...interface{})
- func Init(env *environment.Env)
- func Middleware() gin.HandlerFunc
- func Panic(args ...interface{})
- func SetOutput(writer io.Writer)
- func Trace(args ...interface{})
- func Warn(args ...interface{})
- func WithError(err interface{}) *logrus.Entry
- func WithField(key string, value interface{}) *logrus.Entry
- func WithFields(fields logrus.Fields) *logrus.Entry
- type Formatter
- func (f *Formatter) Error()
- func (f *Formatter) Fields()
- func (f *Formatter) Format(entry *logrus.Entry) ([]byte, error)
- func (f *Formatter) HasError() (interface{}, bool)
- func (f *Formatter) IP()
- func (f *Formatter) Level()
- func (f *Formatter) Message()
- func (f *Formatter) Method()
- func (f *Formatter) StatusCode()
- func (f *Formatter) Time()
- func (f *Formatter) URL()
- type WriterHook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init(env *environment.Env)
Init will set up the logger and set logging levels dependant on environment variables.
func Middleware ¶
func Middleware() gin.HandlerFunc
Middleware
Middleware is the handler function for logging system application messages, if there was an error or message set, it will be retrieved from the context. Status codes between 200 and 400 will be logged as info, otherwise an error.
Types ¶
type Formatter ¶
type Formatter struct { Colours bool TimestampFormat string Debug bool // contains filtered or unexported fields }
Formatter implements logrus.Formatter interface.
func (*Formatter) Error ¶
func (f *Formatter) Error()
Error
Prints out the error if there is one set. If the error is nil, nothing will be printed.
func (*Formatter) Level ¶
func (f *Formatter) Level()
Level
Prints the entry level of the log entry in uppercase.
func (*Formatter) Message ¶
func (f *Formatter) Message()
Message
Prints the entry message if there is obe set.
func (*Formatter) Method ¶
func (f *Formatter) Method()
Method
Prints the entry request method if there is one set.
func (*Formatter) StatusCode ¶
func (f *Formatter) StatusCode()
StatusCode
Prints the status code of the request, if there is none set the log is config and "VRB" will be printed.
type WriterHook ¶
type WriterHook struct { // The io.Writer, this can be stdout or stderr. Writer io.Writer // The slice of log levels the writer can too. LogLevels []logrus.Level }
WriterHook is a hook that writes logs of specified LogLevels to specified Writer.
func (*WriterHook) Fire ¶
func (hook *WriterHook) Fire(entry *logrus.Entry) error
Fire
Fire will be called when some logging function is called with current hook. It will format log entry to string and write it to appropriate writer
func (*WriterHook) Levels ¶
func (hook *WriterHook) Levels() []logrus.Level
Levels
Define on which log levels this hook would trigger