Documentation ¶
Overview ¶
Package log contains utilities for logging in a modular interface. This package can be used to wrap a third party library.
Index ¶
- Constants
- Variables
- type Config
- type Logger
- func (l *Logger) Debugf(message string, other ...interface{})
- func (l *Logger) Debugln(message string)
- func (l *Logger) Errorf(message string, other ...interface{})
- func (l *Logger) Errorln(message string)
- func (l *Logger) Fatalf(message string, other ...interface{})
- func (l *Logger) Fatalln(message string)
- func (l *Logger) Infof(message string, other ...interface{})
- func (l *Logger) Infoln(message string)
- func (l *Logger) NewModule(prefix string) Modular
- func (l *Logger) Output(calldepth int, s string) error
- func (l *Logger) Tracef(message string, other ...interface{})
- func (l *Logger) Traceln(message string)
- func (l *Logger) Warnf(message string, other ...interface{})
- func (l *Logger) Warnln(message string)
- type Modular
Constants ¶
View Source
const ( LogOff int = 0 LogFatal int = 1 LogError int = 2 LogWarn int = 3 LogInfo int = 4 LogDebug int = 5 LogTrace int = 6 LogAll int = 7 )
Logger level constants
Variables ¶
View Source
var (
ErrClientNil = errors.New("the client pointer was nil")
)
Errors used throughout the package.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Prefix string `json:"prefix" yaml:"prefix"` LogLevel string `json:"log_level" yaml:"log_level"` AddTimeStamp bool `json:"add_timestamp" yaml:"add_timestamp"` JSONFormat bool `json:"json_format" yaml:"json_format"` }
Config holds configuration options for a logger object.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is an object with support for levelled logging and modular components.
func (*Logger) NewModule ¶
NewModule creates a new logger object from the previous, using the same configuration, but adds an extra prefix to represent a submodule.
type Modular ¶
type Modular interface { NewModule(prefix string) Modular Fatalf(message string, other ...interface{}) Errorf(message string, other ...interface{}) Warnf(message string, other ...interface{}) Infof(message string, other ...interface{}) Debugf(message string, other ...interface{}) Tracef(message string, other ...interface{}) Fatalln(message string) Errorln(message string) Warnln(message string) Infoln(message string) Debugln(message string) Traceln(message string) Output(calldepth int, s string) error }
Modular is a log printer that allows you to branch new modules.
Click to show internal directories.
Click to hide internal directories.