Log: A minimal, colorful Go logging library 🪵

This page summarizes the projects mentioned and recommended in the original post on /r/golang

Our great sponsors
  • Mergify - Updating dependencies is time-consuming.
  • SonarLint - Clean code begins in your IDE with SonarLint
  • InfluxDB - Collect and Analyze Billions of Data Points in Real Time
  • log

    A minimal, colorful Go logging library 🪵 (by charmbracelet)

  • humanlog

    Logs for humans to read.

    I also think there's a lot more that can be done if your focus is on "human readable" beyond just "logging with colors". I've played around with this myself while trying slog on for size and inspired by humanlog. Things like visually distinguishing the message, while also visually minimizing the timestamp with color and marking keyvals differently to the main message and even allowing for indentation and grouping of output are important considerations when you know you have a TTY and don't care about being machine-readable or even particularly fast. In that regard, I think that charmbracelet/log could be doing more.

  • Mergify

    Updating dependencies is time-consuming.. Solutions like Dependabot or Renovate update but don't merge dependencies. You need to do it manually while it could be fully automated! Add a Merge Queue to your workflow and stop caring about PR management & merging. Try Mergify for free.

  • tracing

    Application level tracing for Rust.

    To date I think tracing (Rust) did this best. That is just a facade that decouples producers from subscribers in a neat API. The official tracing-subscriber has a fantastic console format that ticks all the boxes we're discussing here, in fact it's similar to the screenshot in OP, and it also has a tidy JSON format not too far off from Zap or Zerolog. I found it very easy to wrap a subscriber to tweak the format for console readability even more. But if you didn't like any of that, you could use another subscriber without changing any producer code at all, because it all goes through the facade.

  • fasthttp

    Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http

    As I said in another comment, I think net/http is a good cautionary tale here. It was designed to be easy to use, and then grew organically, but performance never seems to have been a goal. fasthttp solves this, but bifurcates the ecosystem and passes on those costs to everyone who uses it. If net/http had been designed with performance in mind, this could have been avoided. net/http can't be removed or optimized, so this is a situation the Go ecosystem is effectively stuck with forever. At best, a faster version may end up in the std lib, just like netip is more modern and faster than net but the ecosystem is still bifurcated and adoption of the new package has been slow.

  • vhs

    Your CLI home video recorder 📼

  • SonarLint

    Clean code begins in your IDE with SonarLint. Up your coding game and discover issues early. SonarLint is a free plugin that helps you find & fix bugs and security issues from the moment you start writing code. Install from your favorite IDE marketplace today.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts