Skip to content

Logger that wraps zerolog and fits for use with gorm.

License

Notifications You must be signed in to change notification settings

ao-concepts/logging

Repository files navigation

ao-concepts logging module

CI codecov

This module provides a logger that fits for use within the ao-concepts ecosystem.

Information

The ao-concepts ecosystem is still under active development and therefore the API of this module may have breaking changes until there is a first stable release.

If you are interested in contributing to this project, feel free to open a issue to discus a new feature, enhancement or improvement. If you found a bug or security vulnerability in this package, please start a issue, or open a PR against master.

Installation

go get -u github.com/ao-concepts/logging

Usage

The DefaultLogger is a wrapper around github.com/rs/zerolog It integrates into gorm.io/gorm by using the CreateGormLogger function.

You can specify a io.Writer that is used by the logger. By default the logger uses os.Stdout.

log := logging.New(logging.Warn, nil)

log.ErrError(err)
log.Error("string", arg1, arg2)

Used packages

This project uses some really great packages. Please make sure to check them out!

Package Usage
github.com/rs/zerolog The default logger
github.com/stretchr/testify Testing
gorm.io/gorm Database access