Documentation
¶
Index ¶
- Constants
- Variables
- type ColorLogger
- func (logger *ColorLogger) Debug(format string, args ...interface{})
- func (logger *ColorLogger) Error(format string, args ...interface{})
- func (logger *ColorLogger) GetLevel() int
- func (logger *ColorLogger) Info(format string, args ...interface{})
- func (logger *ColorLogger) Trace(format string, args ...interface{})
- func (logger *ColorLogger) Warn(format string, args ...interface{})
- type DefaultLogger
- type Func
- type Logger
Constants ¶
const LOG_LEVEL_ALL int = 0
const LOG_LEVEL_INFO int = 1
const LOG_LEVEL_NONE int = 3
const LOG_LEVEL_WARN int = 2
Variables ¶
var NilLogger = &nilLogger{}
Functions ¶
This section is empty.
Types ¶
type ColorLogger ¶
type ColorLogger struct {
// Verbose must be set to true in order for Trace log messages to be emitted.
Verbose bool
// Level is the threshold for this ColorLogger.
//
// Logging messages which are less severe than level will be ignored.
//
// Logging messages with a severity equal or greater than level will be emitted.
//
// Levels are represented numerically, with 0 being the most "severe" and 3 being the least "severe".
//
// When Level is set to LOG_LEVEL_NONE (3), no messages will be emitted.
//
// When Level is set to LOG_LEVEL_ALL, all messages except for Trace messages will be emitted.
//
// In order for Trace messages to be emitted, Level must be set to LOG_LEVEL_ALL, and Verbose must be set to true.
Level int
// Prefix is intended to be the name of the entity emitting the log messages.
// The prefix is prepended to the beginning of every log message.
Prefix string
// Color is a boolean flag indicating whether colored output is enabled (true) or not (false).
Color bool
// LogTypePrefix is a bool flag that, when true, instructs the logger to also prepend the type of
// a given log message (e.g., "ERROR", "WARNING", "DEBUG", "TRACE", or "INFO") to the beginning of
// the message when emitting it.
LogTypePrefix bool
}
ColorLogger - A Logger that logs to stdout in color
func (*ColorLogger) Debug ¶
func (logger *ColorLogger) Debug(format string, args ...interface{})
Debug - Log a debug message
func (*ColorLogger) Error ¶
func (logger *ColorLogger) Error(format string, args ...interface{})
Error - Log a error
func (*ColorLogger) Info ¶
func (logger *ColorLogger) Info(format string, args ...interface{})
Info - Log a general message
func (*ColorLogger) Trace ¶
func (logger *ColorLogger) Trace(format string, args ...interface{})
Trace - Log a very verbose trace message
func (*ColorLogger) Warn ¶
func (logger *ColorLogger) Warn(format string, args ...interface{})
Warn - Log a warning
type Func ¶
type Func func() string
Func Function wrapper that support lazy evaluation for the logger
func NewFormatFunc ¶
func NewFormatFunc(f func(msg string, arg ...interface{}) string, msg string, args ...interface{}) Func
NewFormatFunc Create the function wrapper that compatible with fmt.Sprintf
func NewFuncWithArg ¶
NewFuncWithArg Create the function wrapper for func(arg interface{}) string
func NewFuncWithArgs ¶
NewFuncWithArgs Create the function wrapper for func(arg ...interface{}) string
type Logger ¶
type Logger interface {
Trace(format string, args ...interface{})
Debug(format string, args ...interface{})
Info(format string, args ...interface{})
Warn(format string, args ...interface{})
Error(format string, args ...interface{})
GetLevel() int
}
Logger - Interface to pass into Proxy for it to log messages