fnxlogrus package - github.com/fortnoxab/fnxlogrus - Go Packages

fnxlogrus

package module
v0.0.0-...-6a580c5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2022 License: Apache-2.0 Imports: 6 Imported by: 9

README

fnxlogrus

Boilerplate setting up logrus and custom formatter for stacktraces etc.

Install/usage

go get -u github.com/fortnoxab/fnxlogrus

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(config Config, l *logrus.Logger)

Init initializes logrus with level and formatter

Types

type Config

type Config struct {
	Level  string
	Format string `default:"text"`
	//Formatter field is used if you need a custom formatter
	Formatter logrus.Formatter
}

Config is the configuration

type JSONFormatter

type JSONFormatter struct {
	logrus.JSONFormatter
}

JSONFormatter is a logrus.JSONFormatter but with ability to decode stacktraces from github.com/pkg/errors

func (*JSONFormatter) Format

func (jf *JSONFormatter) Format(entry *logrus.Entry) ([]byte, error)

Format makes sure we implement logrus.Formatter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL