logger

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 4 Imported by: 7

Documentation

Overview

Package logger contains tools such as defaults and hooks for working with logrus (github.com/sirupsen/logrus) correctly inside Blacksmith.

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogger = &logrus.Logger{
	Out:   os.Stdout,
	Level: logrus.DebugLevel,
	Hooks: logrus.LevelHooks{},
	Formatter: &logrus.TextFormatter{
		FullTimestamp: true,
	},
	ExitFunc: os.Exit,
}

DefaultLogger is the default logger used in non-production environments when none where passed when creating the application.

View Source
var DefaultLoggerInProduction = &logrus.Logger{
	Out:       os.Stderr,
	Level:     logrus.WarnLevel,
	Hooks:     logrus.LevelHooks{},
	Formatter: &logrus.JSONFormatter{},
	ExitFunc:  os.Exit,
}

DefaultLoggerInProduction is the default logger used in production environments when none where passed when creating the application.

Functions

func New

func New() *logrus.Logger

New returns the appropriate logrus Logger given the environment.

Types

type UsingError

type UsingError struct{}

UsingError respect the logrus Hook interface and allows the Blacksmith logger to format errors across adapters and in the application.

func (*UsingError) Fire

func (hook *UsingError) Fire(entry *logrus.Entry) error

Fire format the given message to an appropriate error.

func (*UsingError) Levels

func (hook *UsingError) Levels() []logrus.Level

Levels return the level used by the hook. Use for error level and above.

Jump to

Keyboard shortcuts

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