package module
v1.0.7 Latest Latest

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

Go to latest
Published: Sep 3, 2022 License: MIT Imports: 10 Imported by: 89


GoDoc Build status Go Report Card


The logger.Logger interface is used throughout Buffalo apps, and other systems, to log a whole manner of things.


$ go get -u github.com/gobuffalo/logger





View Source
const (
	// PanicLevel level, highest level of severity. Logs and then calls panic with the
	// message passed to Debug, Info, ...
	PanicLevel = logrus.PanicLevel
	// FatalLevel level. Logs and then calls `logger.Exit(1)`. It will exit even if the
	// logging level is set to Panic.
	FatalLevel = logrus.FatalLevel
	// ErrorLevel level. Logs. Used for errors that should definitely be noted.
	// Commonly used for hooks to send errors to an error tracking service.
	ErrorLevel = logrus.ErrorLevel
	// WarnLevel level. Non-critical entries that deserve eyes.
	WarnLevel = logrus.WarnLevel
	// InfoLevel level. General operational entries about what's going on inside the
	// application.
	InfoLevel = logrus.InfoLevel
	// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
	DebugLevel = logrus.DebugLevel
View Source
const Version = "v1.0.6"

Version of the logger


This section is empty.


This section is empty.


type FieldLogger

type FieldLogger interface {
	WithField(string, interface{}) FieldLogger
	WithFields(map[string]interface{}) FieldLogger

FieldLogger interface

func New

func New(lvl Level) FieldLogger

New based on the specified log level, defaults to "debug". This logger will log to the STDOUT in a human readable, but parseable form.

Example: time="2016-12-01T21:02:07-05:00" level=info duration=225.283µs human_size="106 B" method=GET path="/" render=199.79µs request_id=2265736089 size=106 status=200

func NewLogger

func NewLogger(level string) FieldLogger

NewLogger based on the specified log level, defaults to "debug". See `New` for more details.

type Level

type Level = logrus.Level

Level of the logger

func ParseLevel

func ParseLevel(level string) (Level, error)

type Logger

type Logger interface {
	Debugf(string, ...interface{})
	Infof(string, ...interface{})
	Printf(string, ...interface{})
	Warnf(string, ...interface{})
	Errorf(string, ...interface{})
	Fatalf(string, ...interface{})

Logger interface is used throughout Buffalo apps to log a whole manner of things.

type Logrus

type Logrus struct {

Logrus is a Logger implementation backed by sirupsen/logrus

func (Logrus) SetOutput

func (l Logrus) SetOutput(w io.Writer)

SetOutput will try and set the output of the underlying logrus.FieldLogger if it can

func (Logrus) WithField

func (l Logrus) WithField(s string, i interface{}) FieldLogger

WithField returns a new Logger with the field added

func (Logrus) WithFields

func (l Logrus) WithFields(m map[string]interface{}) FieldLogger

WithFields returns a new Logger with the fields added

type Outable

type Outable interface {
	SetOutput(out io.Writer)

Outable interface for loggers that allow setting the output writer

Jump to

Keyboard shortcuts

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