logging

package module
Version: v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2019 License: MIT Imports: 7 Imported by: 109

README


Pion Logging

The Pion logging library

Pion transport Slack Widget
Build Status GoDoc Coverage Status Go Report Card


Roadmap

The library is used as a part of our WebRTC implementation. Please refer to that roadmap to track our major milestones.

Community

Pion has an active community on the Golang Slack. Sign up and join the #pion channel for discussions and support. You can also use Pion mailing list.

We are always looking to support your projects. Please reach out if you have something to build!

If you need commercial support or don't want to use public methods you can contact us at team@pion.ly

Contributing

Check out the contributing wiki to join the group of amazing people making this project possible:

License

MIT License - see LICENSE for full text

Documentation

Index

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
)

func (*LogLevel) Get

func (ll *LogLevel) Get() LogLevel

Get retrieves the current LogLevel value

func (*LogLevel) Set

func (ll *LogLevel) Set(newLevel LogLevel)

Set updates the LogLevel to the supplied value

func (LogLevel) String

func (ll LogLevel) String() string

type LoggerFactory

type LoggerFactory interface {
	NewLogger(scope string) LeveledLogger
}

LoggerFactory is the basic pion LoggerFactory interface

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