Skip to content

Releases: jucardi/go-logger-lib

Default logger builder, custom io.Writer

06 Nov 19:49

Choose a tag to compare

In this version the following features were added:

  • New LoggerBuilder definition that defines the contract for a logger constructor function. This LoggerBuilder type is an alias for func(name string, writer ...io.Writer) ILogger, where name specifies the name of the logger, writer is an optional (variadic) variable that is passed, it it should be used to write the logger output when creating a new logger with this builder.\
  • New static function log.New(name string, writer ...io.Writer) which uses a default logger builder.
  • New static function log.SetDefaultBuilder(ctor LoggerBuilder) which allows to specify a default constructor function to use by log.Get(name string) and log.New(name string, writer ...io.Writer) when creating new loggers. By default, the default logger builder is set to a Loggrus builder log.NewLogrus(name string, writer ...io.Writer)
    -log.Get(name string) will now create a logger using the default builder if a logger by the given name does not exist.
  • Added the logger name in the templates for the predefined formatters. By default the logger name will only be shown in the logs if it has been assigned. The default logger is meant for global use which does not have a name defined.

First official release

01 Nov 21:54

Choose a tag to compare

First official release, for information about the library, checkout the documentation at https://github.com/jucardi/go-logger-lib