logger

package
v0.11.0-advanced Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 License: MIT Imports: 4 Imported by: 8

Documentation

Overview

Package logger contains a wrapper around logrus to support a centralized logging config.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidLevel = errors.New("invalid log level")

ErrInvalidLevel is returned when an invalid log level is given in the config

View Source
var Logger *logrus.Logger

Logger is the main logger that is abstracted in this package. It is exported here for use with gorm.

Functions

func Debug

func Debug(args ...interface{})

Debug logs a debug message

func Debugf

func Debugf(format string, args ...interface{})

Debugf logs a formatted debug messsage

func Error

func Error(args ...interface{})

Error logs an error message

func Errorf

func Errorf(format string, args ...interface{})

Errorf logs a formatted error message

func Fatal

func Fatal(args ...interface{})

Fatal logs a fatal error message

func Fatalf

func Fatalf(format string, args ...interface{})

Fatalf logs a formatted fatal error message

func Info

func Info(args ...interface{})

Info logs an informational message

func Infof

func Infof(format string, args ...interface{})

Infof logs a formatted informational message

func Setup

func Setup(config *Config) error

Setup configures the logger based on options in the config.json.

func Warn

func Warn(args ...interface{})

Warn logs a warning message

func Warnf

func Warnf(format string, args ...interface{})

Warnf logs a formatted warning message

func WithFields

func WithFields(fields logrus.Fields) *logrus.Entry

WithFields returns a new log enty with the provided fields

func Writer

func Writer() *io.PipeWriter

Writer returns the current logging writer

Types

type Config

type Config struct {
	Filename string `json:"filename"`
	Level    string `json:"level"`
}

Config represents configuration details for logging.

Jump to

Keyboard shortcuts

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