logger: github.com/gobuffalo/logger Index | Files

package logger

import "github.com/gobuffalo/logger"


Package Files

formatter.go level.go logger.go logrus.go outable.go terminal_check.go version.go


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
const Version = "v1.0.1"

Version of the logger

type FieldLogger Uses

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

FieldLogger interface

func New Uses

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 Uses

func NewLogger(level string) FieldLogger

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

type Level Uses

type Level = logrus.Level

Level of the logger

func ParseLevel Uses

func ParseLevel(level string) (Level, error)

type Logger Uses

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 Uses

type Logrus struct {

Logrus is a Logger implementation backed by sirupsen/logrus

func (Logrus) SetOutput Uses

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 Uses

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

WithField returns a new Logger with the field added

func (Logrus) WithFields Uses

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

WithFields returns a new Logger with the fields added

type Outable Uses

type Outable interface {
    SetOutput(out io.Writer)

Outable interface for loggers that allow setting the output writer

Package logger imports 10 packages (graph) and is imported by 31 packages. Updated 2019-11-25. Refresh now. Tools for package owners.