A simple Go JSON logger.



A simple JSON logger for Go.

It uses a context.Context to store values which will then be logged along with each message.

It is possible to recover these values but this should not be used to pass arguments into functions. Do not use this to pass required arguments.

Using Error or Errorf will also log a stack trace to help you easily find the source of the error.


The API is very small.

  1. Create a logger with logger.New()
  2. (Optional) Call SetDebug(bool) to enable debug logging, or use the DEBUG environment variable
  3. Log using Debug, Info, Error, Debugf, Infof, or Errorf
  4. (Optional) As desired, use With to add a value to the loggers "tags"
  5. (Optional) Recover a value from the tags using ValueString
package main

import (


func main() {
	lg := logger.New()
	lg.Info("first message")
	ctx := context.Background()
	ctx = lg.With(ctx, "user_id", "123")
	lg.Info("second message")

func stuff(ctx context.Context) {
	lg := logger.FromContext(ctx)
	ctx = lg.With(ctx, "function", "stuff")
	lg.Info("thing message")
	userID := lg.ValueString("user_id")
	fmt.Printf("user_id: %s\n", userID)

func crash(ctx context.Context) {
	lg := logger.FromContext(ctx)


{"level":"INFO","event_time":"2021-12-19T03:26:15Z","message":"first message"}
{"level":"INFO","event_time":"2021-12-19T03:26:15Z","message":"second message","tags":{"user_id":"123"}}
{"level":"INFO","event_time":"2021-12-19T03:26:15Z","message":"thing message","tags":{"function":"stuff","user_id":"123"}}
user_id: 123
{"level":"ERROR","event_time":"2021-12-19T03:26:15Z","message":"broken","trace":"main.go:main.crash:30, main.go:main.stuff:25, main.go:main.main:16, proc.go:runtime.main:255","tags":{"function":"stuff","user_id":"123"}}
Shawn Milochik
One of eclectic interests and ephemeral hobbies.
Shawn Milochik
Logger - A thin wrapper of uber-go/zap logger for personal project

a thin wraper of uber-go/zap logger for personal project 0. thanks uber-go/zap B

tsingson 1 Jun 16, 2022
A simple Go JSON logger.

logger A simple JSON logger for Go. It uses a context.Context to store values which will then be logged along with each message. It is possible to rec

Shawn Milochik 1 Dec 20, 2021
Zero Allocation JSON Logger

Zero Allocation JSON Logger The zerolog package provides a fast and simple logger dedicated to JSON output. Zerolog's API is designed to provide both

Olivier Poitrey 6.5k Jun 25, 2022
A powerful zero-dependency json logger.

ZKits Logger Library About This package is a library of ZKits project. This is a zero-dependency standard JSON log library that supports structured JS

Qingshan Luo 16 Jun 15, 2022
alog is a dependency free, zero/minimum memory allocation JSON logger with extensions

Alog (c) 2020-2021 Gon Y Yi. https://gonyyi.com. MIT License Version 1.0.0 Intro Alog was built with a very simple goal in mind: Support Tagging (and

Gon 13 Dec 13, 2021
This package enables json output, level logging and so on to standard go logger.

logplug This package enables json output, level logging and so on to standard logger. Usage log.SetOutput(logplug.NewJSONPlug(os.Stderr, logplug.LogF

Koumei Mikuni 0 Dec 27, 2021
Simple logger for Go programs. Allows custom formats for messages.

go-logger A simple go logger for easy logging in your programs. Allows setting custom format for messages. Preview Install go get github.com/apsdehal/

Amanpreet Singh 276 Jun 14, 2022
Dead simple, super fast, zero allocation and modular logger for Golang

Onelog Onelog is a dead simple but very efficient JSON logger. It is one of the fastest JSON logger out there. Also, it is one of the logger with the

Francois Parquet 399 Jun 16, 2022
Simple Yet Powerful Logger

sypl sypl provides a Simple Yet Powerful Logger built on top of the Golang sypl. A sypl logger can have many Outputs, and each Output is responsible f

Sauce Labs 9 Apr 28, 2022
simple concurrent logger

XMUS-LOGGER pure golang logger compatible with golang io standards. USAGE : logOptions := logger.LoggerOptions{ LogLevel: 6, // read more about lo

amupxm [amir hossein mokarrami far] 5 Sep 19, 2021
🪵 A dead simple, pretty, and feature-rich logger for golang

?? lumber ?? A dead simple, pretty, and feature-rich logger for golang ?? Install ?? Logging Functions lumber.Success() lumber.Info() lumber.Debug() l

Matt Gleich 49 May 26, 2022
A simple logger API.

flog a simple logger API for Go program that save logs into a file. NOTE: This package is provided "as is" with no guarantee. Use it at your own risk

Iss Meftah 3 May 14, 2022
A simple and super power logger for golang

The most powerfull and faster logger for golang powered by DC ?? What is this? W

Teo 7 Jan 23, 2022
A Simple logger for golang

go-logger Installation go get github.com/mo-taufiq/go-logger Quickstart package main import ( gologger "github.com/mo-taufiq/go-logger" ) func main

Moh Taufiqur Rohman 1 Jan 15, 2022
Simple Proof of Concept REST event logger.

REST Event Logger PoC I am working on this project intermittently. I have set myself a time limit of ~3hrs which includes the time to acquire and adap

Saad Ur Rahman 0 Feb 10, 2022
Golog is a logger which support tracing and other custom behaviors out of the box. Blazing fast and simple to use.

GOLOG Golog is an opinionated Go logger with simple APIs and configurable behavior. Why another logger? Golog is designed to address mainly two issues

Damiano Petrungaro 34 Jun 22, 2022
A logger, for Go

Go-Log A logger, for Go! It's sort of log and code.google.com/p/log4go compatible, so in most cases can be used without any code changes. Breaking cha

Ian Kent 38 May 12, 2022
Loggly Hooks for GO Logrus logger

Loggly Hooks for Logrus Usage package main import ( "github.com/sirupsen/logrus" "github.com/sebest/logrusly" ) var logglyToken string = "YOUR_LOG

Sebest 27 Jul 27, 2021
A 12-factor app logger built for performance and happy development

logxi log XI is a structured 12-factor app logger built for speed and happy development. Simpler. Sane no-configuration defaults out of the box. Faste

Mario Gutierrez 348 Jun 25, 2022