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
Expand ▾ Collapse ▴

Documentation

Index

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 Prepare

func Prepare(e *echo.Echo)

Prepare configures everything logging related

func PrepareWithSentry

func PrepareWithSentry(e *echo.Echo, sentryOptions *sentry.ClientOptions)

PrepareWithSentry allows customizing the sentry client options

Types

type EchoLogger

type EchoLogger struct{}

EchoLogger is a logger for echo based on Zerolog

func (EchoLogger) Debug

func (l EchoLogger) Debug(i ...interface{})

Debug forwards to zerolog

func (EchoLogger) Debugf

func (l EchoLogger) Debugf(format string, args ...interface{})

Debugf forwards to zerolog

func (EchoLogger) Debugj

func (l EchoLogger) Debugj(j el.JSON)

Debugj forwards to zerolog

func (EchoLogger) Error

func (l EchoLogger) Error(i ...interface{})

Error forwards to zerolog

func (EchoLogger) Errorf

func (l EchoLogger) Errorf(format string, args ...interface{})

Errorf forwards to zerolog

func (EchoLogger) Errorj

func (l EchoLogger) Errorj(j el.JSON)

Errorj forwards to zerolog

func (EchoLogger) Fatal

func (l EchoLogger) Fatal(i ...interface{})

Fatal forwards to zerolog

func (EchoLogger) Fatalf

func (l EchoLogger) Fatalf(format string, args ...interface{})

Fatalf forwards to zerolog

func (EchoLogger) Fatalj

func (l EchoLogger) Fatalj(j el.JSON)

Fatalj forwards to zerolog

func (EchoLogger) Info

func (l EchoLogger) Info(i ...interface{})

Info forwards to zerolog

func (EchoLogger) Infof

func (l EchoLogger) Infof(format string, args ...interface{})

Infof forwards to zerolog

func (EchoLogger) Infoj

func (l EchoLogger) Infoj(j el.JSON)

Infoj forwards to zerolog

func (EchoLogger) Level

func (l EchoLogger) Level() el.Lvl

Level returns the level of the zerologger

func (EchoLogger) Output

func (l EchoLogger) Output() io.Writer

Output returns Stderr

func (EchoLogger) Panic

func (l EchoLogger) Panic(i ...interface{})

Panic forwards to zerolog

func (EchoLogger) Panicf

func (l EchoLogger) Panicf(format string, args ...interface{})

Panicf forwards to zerolog

func (EchoLogger) Panicj

func (l EchoLogger) Panicj(j el.JSON)

Panicj forwards to zerolog

func (EchoLogger) Prefix

func (l EchoLogger) Prefix() string

Prefix returns an empty string

func (EchoLogger) Print

func (l EchoLogger) Print(i ...interface{})

Print forwards to zerolog

func (EchoLogger) Printf

func (l EchoLogger) Printf(format string, args ...interface{})

Printf forwards to zerolog

func (EchoLogger) Printj

func (l EchoLogger) Printj(j el.JSON)

Printj forwards to zerolog

func (EchoLogger) SetHeader

func (l EchoLogger) SetHeader(h string)

SetHeader does nothing

func (EchoLogger) SetLevel

func (l EchoLogger) SetLevel(v el.Lvl)

SetLevel does nothing

func (EchoLogger) SetOutput

func (l EchoLogger) SetOutput(w io.Writer)

SetOutput does nothing

func (EchoLogger) SetPrefix

func (l EchoLogger) SetPrefix(p string)

SetPrefix does nothing

func (EchoLogger) Warn

func (l EchoLogger) Warn(i ...interface{})

Warn forwards to zerolog

func (EchoLogger) Warnf

func (l EchoLogger) Warnf(format string, args ...interface{})

Warnf forwards to zerolog

func (EchoLogger) Warnj

func (l EchoLogger) Warnj(j el.JSON)

Warnj forwards to zerolog