Version: v0.0.0-...-84d4e1c Latest Latest

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

Go to latest
Published: Apr 3, 2019 License: MIT-0 Imports: 4 Imported by: 0



logger provides with a simple interface for logging so that our application logs are well structured and it is easy to process them with tools such as Elastic search



This section is empty.


This section is empty.


func Error

func Error(err error)

Error logs a structured log error entry

func Info

func Info(msg string, data interface{})

Info logs a structured log info entry with some extra data

func NewHttpLogger

func NewHttpLogger() func(next http.Handler) http.Handler

NewHttpLogger returns a simple middleware that produces structured logs from our http requests. This middleware also inspects the current request for extra errors (eg. database errors) that should be printed in the logs too


type GenericLogEntry

type GenericLogEntry struct {
	Severity string      `json:"severity"`
	Msg      string      `json:"msg"`
	Time     int         `json:"ts"`
	Data     interface{} `json:"data"`

LogGenericEntry is a generic log entry structure so that we can use this library from everywhere in our code and we keep application logs more or less consistent and structured

type HttpLogEntry

type HttpLogEntry struct {
	Severity string `json:"severity"`
	Method   string `json:"method"`
	Uri      string `json:"uri"`
	Time     int    `json:"ts"`
	Usec     int    `json:"usec"`
	Status   int    `json:"status"`

LogHttpEntry a log entry that captures the information we are interested in about a http response

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL