Documentation ¶
Index ¶
- type DefaultLeveledLogger
- func (ll *DefaultLeveledLogger) Debug(msg string)
- func (ll *DefaultLeveledLogger) Debugf(format string, args ...interface{})
- func (ll *DefaultLeveledLogger) Error(msg string)
- func (ll *DefaultLeveledLogger) Errorf(format string, args ...interface{})
- func (ll *DefaultLeveledLogger) Info(msg string)
- func (ll *DefaultLeveledLogger) Infof(format string, args ...interface{})
- func (ll *DefaultLeveledLogger) SetLevel(newLevel LogLevel)
- func (ll *DefaultLeveledLogger) Trace(msg string)
- func (ll *DefaultLeveledLogger) Tracef(format string, args ...interface{})
- func (ll *DefaultLeveledLogger) Warn(msg string)
- func (ll *DefaultLeveledLogger) Warnf(format string, args ...interface{})
- func (ll *DefaultLeveledLogger) WithDebugLogger(log *log.Logger) *DefaultLeveledLogger
- func (ll *DefaultLeveledLogger) WithErrorLogger(log *log.Logger) *DefaultLeveledLogger
- func (ll *DefaultLeveledLogger) WithInfoLogger(log *log.Logger) *DefaultLeveledLogger
- func (ll *DefaultLeveledLogger) WithOutput(output io.Writer) *DefaultLeveledLogger
- func (ll *DefaultLeveledLogger) WithTraceLogger(log *log.Logger) *DefaultLeveledLogger
- func (ll *DefaultLeveledLogger) WithWarnLogger(log *log.Logger) *DefaultLeveledLogger
- type DefaultLoggerFactory
- type LeveledLogger
- type LogLevel
- type LoggerFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultLeveledLogger ¶
type DefaultLeveledLogger struct {
// contains filtered or unexported fields
}
DefaultLeveledLogger encapsulates functionality for providing logging at user-defined levels
func NewDefaultLeveledLoggerForScope ¶
func NewDefaultLeveledLoggerForScope(scope string, level LogLevel, writer io.Writer) *DefaultLeveledLogger
NewDefaultLeveledLoggerForScope returns a configured LeveledLogger
func (*DefaultLeveledLogger) Debug ¶
func (ll *DefaultLeveledLogger) Debug(msg string)
Debug emits the preformatted message if the logger is at or below LogLevelDebug
func (*DefaultLeveledLogger) Debugf ¶
func (ll *DefaultLeveledLogger) Debugf(format string, args ...interface{})
Debugf formats and emits a message if the logger is at or below LogLevelDebug
func (*DefaultLeveledLogger) Error ¶
func (ll *DefaultLeveledLogger) Error(msg string)
Error emits the preformatted message if the logger is at or below LogLevelError
func (*DefaultLeveledLogger) Errorf ¶
func (ll *DefaultLeveledLogger) Errorf(format string, args ...interface{})
Errorf formats and emits a message if the logger is at or below LogLevelError
func (*DefaultLeveledLogger) Info ¶
func (ll *DefaultLeveledLogger) Info(msg string)
Info emits the preformatted message if the logger is at or below LogLevelInfo
func (*DefaultLeveledLogger) Infof ¶
func (ll *DefaultLeveledLogger) Infof(format string, args ...interface{})
Infof formats and emits a message if the logger is at or below LogLevelInfo
func (*DefaultLeveledLogger) SetLevel ¶
func (ll *DefaultLeveledLogger) SetLevel(newLevel LogLevel)
SetLevel sets the logger's logging level
func (*DefaultLeveledLogger) Trace ¶
func (ll *DefaultLeveledLogger) Trace(msg string)
Trace emits the preformatted message if the logger is at or below LogLevelTrace
func (*DefaultLeveledLogger) Tracef ¶
func (ll *DefaultLeveledLogger) Tracef(format string, args ...interface{})
Tracef formats and emits a message if the logger is at or below LogLevelTrace
func (*DefaultLeveledLogger) Warn ¶
func (ll *DefaultLeveledLogger) Warn(msg string)
Warn emits the preformatted message if the logger is at or below LogLevelWarn
func (*DefaultLeveledLogger) Warnf ¶
func (ll *DefaultLeveledLogger) Warnf(format string, args ...interface{})
Warnf formats and emits a message if the logger is at or below LogLevelWarn
func (*DefaultLeveledLogger) WithDebugLogger ¶
func (ll *DefaultLeveledLogger) WithDebugLogger(log *log.Logger) *DefaultLeveledLogger
WithDebugLogger is a chainable configuration function which sets the Debug-level logger
func (*DefaultLeveledLogger) WithErrorLogger ¶
func (ll *DefaultLeveledLogger) WithErrorLogger(log *log.Logger) *DefaultLeveledLogger
WithErrorLogger is a chainable configuration function which sets the Error-level logger
func (*DefaultLeveledLogger) WithInfoLogger ¶
func (ll *DefaultLeveledLogger) WithInfoLogger(log *log.Logger) *DefaultLeveledLogger
WithInfoLogger is a chainable configuration function which sets the Info-level logger
func (*DefaultLeveledLogger) WithOutput ¶
func (ll *DefaultLeveledLogger) WithOutput(output io.Writer) *DefaultLeveledLogger
WithOutput is a chainable configuration function which sets the logger's logging output to the supplied io.Writer
func (*DefaultLeveledLogger) WithTraceLogger ¶
func (ll *DefaultLeveledLogger) WithTraceLogger(log *log.Logger) *DefaultLeveledLogger
WithTraceLogger is a chainable configuration function which sets the Trace-level logger
func (*DefaultLeveledLogger) WithWarnLogger ¶
func (ll *DefaultLeveledLogger) WithWarnLogger(log *log.Logger) *DefaultLeveledLogger
WithWarnLogger is a chainable configuration function which sets the Warn-level logger
type DefaultLoggerFactory ¶
type DefaultLoggerFactory struct { Writer io.Writer DefaultLogLevel LogLevel ScopeLevels map[string]LogLevel }
DefaultLoggerFactory define levels by scopes and creates new DefaultLeveledLogger
func NewDefaultLoggerFactory ¶
func NewDefaultLoggerFactory() *DefaultLoggerFactory
NewDefaultLoggerFactory creates a new DefaultLoggerFactory
func (*DefaultLoggerFactory) NewLogger ¶
func (f *DefaultLoggerFactory) NewLogger(scope string) LeveledLogger
NewLogger returns a configured LeveledLogger for the given , argsscope
type LeveledLogger ¶
type LeveledLogger interface { Trace(msg string) Tracef(format string, args ...interface{}) Debug(msg string) Debugf(format string, args ...interface{}) Info(msg string) Infof(format string, args ...interface{}) Warn(msg string) Warnf(format string, args ...interface{}) Error(msg string) Errorf(format string, args ...interface{}) }
LeveledLogger is the basic pion Logger interface
type LogLevel ¶
type LogLevel int32
LogLevel represents the level at which the logger will emit log messages
const ( // LogLevelDisabled completely disables logging of any events LogLevelDisabled LogLevel = iota // LogLevelError is for fatal errors which should be handled by user code, // but are logged to ensure that they are seen LogLevelError // LogLevelWarn is for logging abnormal, but non-fatal library operation LogLevelWarn // LogLevelInfo is for logging normal library operation (e.g. state transitions, etc.) LogLevelInfo // LogLevelDebug is for logging low-level library information (e.g. internal operations) LogLevelDebug // LogLevelTrace is for logging very low-level library information (e.g. network traces) LogLevelTrace )
type LoggerFactory ¶
type LoggerFactory interface {
NewLogger(scope string) LeveledLogger
}
LoggerFactory is the basic pion LoggerFactory interface