logger

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LogLevelNames = map[string]Level{
		"debug":    LogDebug,
		"info":     LogInfo,
		"warn":     LogWarning,
		"warning":  LogWarning,
		"warnings": LogWarning,
		"error":    LogError,
		"errors":   LogError,
	}
	LogLevelDisplayNames = map[Level]string{
		LogDebug:   "debug",
		LogInfo:    "info",
		LogWarning: "warning",
		LogError:   "error",
	}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// logging methods
	MethodStderr bool
	MethodFile   bool
	Filename     string
	// logging level
	Level Level
	// logging types
	Types         []string
	ExcludedTypes []string
}

Config represents the configuration of a single logger.

type Level

type Level int

Level represents the level to log messages at.

const (
	// LogDebug represents debug messages.
	LogDebug Level = iota
	// LogInfo represents informational messages.
	LogInfo
	// LogWarning represents warnings.
	LogWarning
	// LogError represents errors.
	LogError
)

type Manager

type Manager struct {
	DumpingRawInOut bool
	// contains filtered or unexported fields
}

Manager is the main interface used to log debug/info/error messages.

func NewManager

func NewManager(config ...Config) (*Manager, error)

NewManager returns a new log manager.

func (*Manager) Debug

func (logger *Manager) Debug(logType string, messageParts ...string)

Debug logs the given message as a debug message.

func (*Manager) Error

func (logger *Manager) Error(logType string, messageParts ...string)

Error logs the given message as an error message.

func (*Manager) Fatal

func (logger *Manager) Fatal(logType string, messageParts ...string)

Fatal logs the given message as an error message, then exits.

func (*Manager) Info

func (logger *Manager) Info(logType string, messageParts ...string)

Info logs the given message as an info message.

func (*Manager) Log

func (logger *Manager) Log(level Level, logType string, messageParts ...string)

Log logs the given message with the given details.

func (*Manager) Warning

func (logger *Manager) Warning(logType string, messageParts ...string)

Warning logs the given message as a warning message.

Jump to

Keyboard shortcuts

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