Logger and Clean Architecture

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

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • zap

    Blazing fast, structured, leveled logging in Go.

  • Hello Gophers, I read about Clean Architecture and I don't find anything regarding Logger which is sometime really nested in the code base. I really like https://github.com/uber-go/zap and even with a Logger interface I don't see how to keep things like the zap.String, zap.Int, etc. compatible with it. Is this a case where you have to compromise? Where you can compromise? Sometimes it is a reproach made to this type of architecture and the way people tend to stick to it too much, e.g., I can change the database but in fact it will probably never happen (but it will help for testing). Can it be the same with the Logger? Maybe I will create an interface with so much cohesion with Zap that it fact it is maybe better to assume that the project will use directly Zap?

  • logr

    A simple logging interface for Go

  • I'd say it depends. If I write a package for others to use I usually don't include a logger at all and let the user decide what he wants to use. For any other project that needs logging I usually skip the interface to not have the struggle with finding one interface that fits all at least logrus and zap. We kinda agreed at the team to just use zap by now. One.thing i wanted to try tho is using sth like logr which provides an interface for the most commonly used loggers.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • life

  • This is why we wrote https://github.com/go-logr/life - it's the interface you can pass around while leaving the choice of implementation up to the topmost app layer. We include some implementation choices (zapr being one, and funcr being among the simplest) but that's not really the goal.

  • go-core

  • Something like this can help https://github.com/facily-tech/go-core/blob/main/log/interface.go

  • log15

    Structured, composable logging for Go

  • This cracks me up: https://github.com/inconshreveable/log15 and I use log15 :)

  • go-logger

    A unified logging library with interchangeable backends (by InVisionApp)

  • For that reason I would advise to use any logging aggregators that have rich adapters and capabilities to add new ones, eg. something like this: https://github.com/InVisionApp/go-logger . Note that this particular project is now abandoned (serious mem leak I posted as PR was never merged; I use my custom, public fork for that reason) so it is worth to ask: does anyone know about anything more recent, active and maintained that implements similar concept?

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

  • Version 1.18 Refresh for Go Programmers

    2 projects | /r/golang | 20 Jun 2022
  • Desvendando o package fmt do Go

    1 project | dev.to | 1 Nov 2023
  • Kubebuilder Tips and Tricks

    2 projects | dev.to | 22 Aug 2023
  • Efficient logging in Go?

    1 project | /r/golang | 11 Jun 2023
  • Go err handle

    2 projects | /r/golang | 8 Mar 2023