logger

package
v0.0.0-...-5d654d2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2017 License: Apache-2.0 Imports: 2 Imported by: 7

Documentation

Overview

Logger is a simple wrapper for logrus.Logger which extends it's capabilities by providing Logger's per category. This is useful when an application is broken up into different components and different levels set per category

Index

Constants

View Source
const (
	DefaultCategory   = "_"
	DefaultTimeFormat = "2006-01-02T15:04:05.000"
)

Variables

This section is empty.

Functions

func SetLevel

func SetLevel(level logrus.Level, category string)

SetLevel enforces the specified level on the specified category. If a logger for the category hasn't been defined then this is a no-op. In some cases you may want to globally initialize all logging modules ahead of time, in this scenario you can call GetLogger and set the returned pointers Level

func SetLogConfigurationHook

func SetLogConfigurationHook(hook LogConfigurationHook)

Types

type Log

type Log struct {

	// inherit from logrus logger
	logrus.Logger
	// contains filtered or unexported fields
}

Logger is a wrapper for a logrus.Logger which adds a category

func GetLogger

func GetLogger(category string) *Log

GetLogger returns an existing logger for the specified category or creates a new one if it hasn't been defined

func Logger

func Logger() *Log

Logger is a simple accessor to the global logging instance

func (*Log) Category

func (l *Log) Category() string

type LogConfigurationHook

type LogConfigurationHook interface {

	// ConfigureLogger is a hook which allows custom setup and overrides for the default
	// category based logger.  This allows the implementation to override formatting, output
	// and level hooks.
	ConfigureLogger(logger *Log)
}

Jump to

Keyboard shortcuts

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