Categorygithub.com/johnmackenzie91/commonlogger
modulepackage
0.0.2
Repository: https://github.com/johnmackenzie91/commonlogger.git
Documentation: pkg.go.dev

# README

The Common Logger

This is an attempt to build a minimal, slim and flexible interface for logging withing go apps.

The interface looks like;

type ErrorInfoDebugger interface {
	Error(...interface{})
	Info(...interface{})
	Debug(...interface{})
}

The idea being that you can put almost whatever you want into the above functions and this library will attempt to transform them into logrus.Fields and supply them to the log line.

For complex types such as context (where you may want to parse a request-id), or a request object (where you may want to remove PII data). Custom call back functions can be supplied.

Why only three methods?

This interface has come around because on the back of Dave Cheney's post but with the addition of the Error(...interface) method. For where a bigger, more poluted interface is needed perhaps we could supplied a wrapper for this lib which exposes those additonal logging methods.

But it is tied to logrus!

Logrus is the logging library I am most confident with. Also creating an abstraction layer would just add more complexity.

Any examples?

Example can be found here

# Packages

No description provided by the author
No description provided by the author

# Functions

New instansiates a new Logger.
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
Logger the struct which implements the ErrorInfoDebugger interface.

# Interfaces

ErrorInfoDebugger represents the entire interface exposed by this package.

# Type aliases

No description provided by the author