log

Stroom log

MIT License

Stars
4

Stroom Log™

Simple logger inspired by bwmarrin/lit with fields, opentracing and json output support.

Design Philosophy

The design of the API is inspired by Grafana's Loki log aggregation system and structured logging practices. As a result, it heavily favours using fields to log variable data and having log messages be the same regardless of the contextual data.

Example:

log.WithFields(log.Fields{
    "userId": user.id,
    "requestId": requestId,
}).Info("user logged in successfully")

instead of

log.Info("request %s user %d logged in successfully", user.id, requestId)

Usage

Fetch the package:

go get github.com/Strum355/log

and import it:

import (
    "github.com/Strum355/log"
)

initialize the logger for development:

log.InitSimpleLogger(&log.Config{...})

or for production using a JSON log parser like FluentD

log.InitJSONlogger(&log.Config{...})
Package Rankings
Top 8.17% on Proxy.golang.org
Badges
Extracted from project README
Build Status GoDoc Go report