logger

package
Version: v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LogLevelNames takes a config name and gives the real log level.
	LogLevelNames = map[string]Level{
		"debug":    LogDebug,
		"info":     LogInfo,
		"warn":     LogWarning,
		"warning":  LogWarning,
		"warnings": LogWarning,
		"error":    LogError,
		"errors":   LogError,
	}
	// LogLevelDisplayNames gives the display name to use for our log levels.
	LogLevelDisplayNames = map[Level]string{
		LogDebug:   "debug",
		LogInfo:    "info",
		LogWarning: "warning",
		LogError:   "error",
	}
)

Functions

This section is empty.

Types

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 LoggingConfig added in v0.10.0

type LoggingConfig struct {
	Method        string
	MethodStdout  bool
	MethodStderr  bool
	MethodFile    bool
	Filename      string
	TypeString    string   `yaml:"type"`
	Types         []string `yaml:"real-types"`
	ExcludedTypes []string `yaml:"real-excluded-types"`
	LevelString   string   `yaml:"level"`
	Level         Level    `yaml:"level-real"`
}

LoggingConfig represents the configuration of a single logger.

type Manager

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

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

func NewManager

func NewManager(config []LoggingConfig) (*Manager, error)

NewManager returns a new log manager.

func (*Manager) ApplyConfig added in v0.10.0

func (logger *Manager) ApplyConfig(config []LoggingConfig) error

ApplyConfig applies the given config to this logger (rehashes the config, in other words).

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) Info

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

Info logs the given message as an info message.

func (*Manager) IsLoggingRawIO added in v0.10.0

func (logger *Manager) IsLoggingRawIO() bool

IsLoggingRawIO returns true if raw user input and output is being logged.

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.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL