README
Logging
A simple utility to provide consistent logging accross all apps.
Usage
Call the Prepare
function at startup and dimply use zerolog.
The prepare functions:
- register an echo middleware to log requests
- set a logger based on zerolog to the default Echo Logger
- if the
SENTRY_DSN
env var is defind, it adds a hook so that all errors are logged to sentry as well
Documentation
Index ¶
- func Middleware() echo.MiddlewareFunc
- func Prepare(e *echo.Echo)
- func PrepareWithSentry(e *echo.Echo, sentryOptions *sentry.ClientOptions)
- type EchoLogger
- func (l EchoLogger) Debug(i ...interface{})
- func (l EchoLogger) Debugf(format string, args ...interface{})
- func (l EchoLogger) Debugj(j el.JSON)
- func (l EchoLogger) Error(i ...interface{})
- func (l EchoLogger) Errorf(format string, args ...interface{})
- func (l EchoLogger) Errorj(j el.JSON)
- func (l EchoLogger) Fatal(i ...interface{})
- func (l EchoLogger) Fatalf(format string, args ...interface{})
- func (l EchoLogger) Fatalj(j el.JSON)
- func (l EchoLogger) Info(i ...interface{})
- func (l EchoLogger) Infof(format string, args ...interface{})
- func (l EchoLogger) Infoj(j el.JSON)
- func (l EchoLogger) Level() el.Lvl
- func (l EchoLogger) Output() io.Writer
- func (l EchoLogger) Panic(i ...interface{})
- func (l EchoLogger) Panicf(format string, args ...interface{})
- func (l EchoLogger) Panicj(j el.JSON)
- func (l EchoLogger) Prefix() string
- func (l EchoLogger) Print(i ...interface{})
- func (l EchoLogger) Printf(format string, args ...interface{})
- func (l EchoLogger) Printj(j el.JSON)
- func (l EchoLogger) SetHeader(h string)
- func (l EchoLogger) SetLevel(v el.Lvl)
- func (l EchoLogger) SetOutput(w io.Writer)
- func (l EchoLogger) SetPrefix(p string)
- func (l EchoLogger) Warn(i ...interface{})
- func (l EchoLogger) Warnf(format string, args ...interface{})
- func (l EchoLogger) Warnj(j el.JSON)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
func Middleware() echo.MiddlewareFunc
Middleware is an echo middleware for zerolog
func PrepareWithSentry ¶
PrepareWithSentry allows customizing the sentry client options
Types ¶
type EchoLogger ¶
type EchoLogger struct{}
EchoLogger is a logger for echo based on Zerolog
func (EchoLogger) Debugf ¶
func (l EchoLogger) Debugf(format string, args ...interface{})
Debugf forwards to zerolog
func (EchoLogger) Errorf ¶
func (l EchoLogger) Errorf(format string, args ...interface{})
Errorf forwards to zerolog
func (EchoLogger) Fatalf ¶
func (l EchoLogger) Fatalf(format string, args ...interface{})
Fatalf forwards to zerolog
func (EchoLogger) Infof ¶
func (l EchoLogger) Infof(format string, args ...interface{})
Infof forwards to zerolog
func (EchoLogger) Level ¶
func (l EchoLogger) Level() el.Lvl
Level returns the level of the zerologger
func (EchoLogger) Panicf ¶
func (l EchoLogger) Panicf(format string, args ...interface{})
Panicf forwards to zerolog
func (EchoLogger) Printf ¶
func (l EchoLogger) Printf(format string, args ...interface{})
Printf forwards to zerolog
func (EchoLogger) Warnf ¶
func (l EchoLogger) Warnf(format string, args ...interface{})
Warnf forwards to zerolog