logging

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2020 License: MIT Imports: 11 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware added in v0.1.1

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 added in v0.1.1

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

PrepareWithSentry allows customizing the sentry client options

Types

type EchoLogger added in v0.1.1

type EchoLogger struct{}

EchoLogger is a logger for echo based on Zerolog

func (EchoLogger) Debug added in v0.1.1

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

Debug forwards to zerolog

func (EchoLogger) Debugf added in v0.1.1

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

Debugf forwards to zerolog

func (EchoLogger) Debugj added in v0.1.1

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

Debugj forwards to zerolog

func (EchoLogger) Error added in v0.1.1

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

Error forwards to zerolog

func (EchoLogger) Errorf added in v0.1.1

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

Errorf forwards to zerolog

func (EchoLogger) Errorj added in v0.1.1

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

Errorj forwards to zerolog

func (EchoLogger) Fatal added in v0.1.1

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

Fatal forwards to zerolog

func (EchoLogger) Fatalf added in v0.1.1

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

Fatalf forwards to zerolog

func (EchoLogger) Fatalj added in v0.1.1

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

Fatalj forwards to zerolog

func (EchoLogger) Info added in v0.1.1

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

Info forwards to zerolog

func (EchoLogger) Infof added in v0.1.1

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

Infof forwards to zerolog

func (EchoLogger) Infoj added in v0.1.1

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

Infoj forwards to zerolog

func (EchoLogger) Level added in v0.1.1

func (l EchoLogger) Level() el.Lvl

Level returns the level of the zerologger

func (EchoLogger) Output added in v0.1.1

func (l EchoLogger) Output() io.Writer

Output returns Stderr

func (EchoLogger) Panic added in v0.1.1

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

Panic forwards to zerolog

func (EchoLogger) Panicf added in v0.1.1

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

Panicf forwards to zerolog

func (EchoLogger) Panicj added in v0.1.1

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

Panicj forwards to zerolog

func (EchoLogger) Prefix added in v0.1.1

func (l EchoLogger) Prefix() string

Prefix returns an empty string

func (EchoLogger) Print added in v0.1.1

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

Print forwards to zerolog

func (EchoLogger) Printf added in v0.1.1

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

Printf forwards to zerolog

func (EchoLogger) Printj added in v0.1.1

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

Printj forwards to zerolog

func (EchoLogger) SetHeader added in v0.1.1

func (l EchoLogger) SetHeader(h string)

SetHeader does nothing

func (EchoLogger) SetLevel added in v0.1.1

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

SetLevel does nothing

func (EchoLogger) SetOutput added in v0.1.1

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

SetOutput does nothing

func (EchoLogger) SetPrefix added in v0.1.1

func (l EchoLogger) SetPrefix(p string)

SetPrefix does nothing

func (EchoLogger) Warn added in v0.1.1

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

Warn forwards to zerolog

func (EchoLogger) Warnf added in v0.1.1

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

Warnf forwards to zerolog

func (EchoLogger) Warnj added in v0.1.1

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

Warnj forwards to zerolog

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL