Skip to content

Commit

Permalink
SRTP and SRTCP has been ported to streams API
Browse files Browse the repository at this point in the history
Send/Recv and RTCP is complete

Relates to #272
Sean-Der committed Jan 3, 2019
1 parent a9e750e commit 6f36df5
Showing 3 changed files with 19 additions and 19 deletions.
24 changes: 12 additions & 12 deletions leveled.go
Original file line number Diff line number Diff line change
@@ -28,8 +28,8 @@ const (
// LogLevelError is for fatal errors which should be handled by user code,
// but are logged to ensure that they are seen
LogLevelError
// LogLevelWarning is for logging abnormal, but non-fatal library operation
LogLevelWarning
// 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)
@@ -102,9 +102,9 @@ func (ll *LeveledLogger) WithInfoLogger(log *log.Logger) *LeveledLogger {
return ll
}

// WithWarningLogger is a chainable configuration function which sets the
// Warning-level logger
func (ll *LeveledLogger) WithWarningLogger(log *log.Logger) *LeveledLogger {
// WithWarnLogger is a chainable configuration function which sets the
// Warn-level logger
func (ll *LeveledLogger) WithWarnLogger(log *log.Logger) *LeveledLogger {
ll.warn = log
return ll
}
@@ -177,14 +177,14 @@ func (ll *LeveledLogger) Infof(format string, args ...interface{}) {
ll.logf(ll.info, LogLevelInfo, format, args...)
}

// Warning emits the preformatted message if the logger is at or below LogLevelWarning
func (ll *LeveledLogger) Warning(msg string) {
ll.logf(ll.warn, LogLevelWarning, msg)
// Warn emits the preformatted message if the logger is at or below LogLevelWarn
func (ll *LeveledLogger) Warn(msg string) {
ll.logf(ll.warn, LogLevelWarn, msg)
}

// Warningf formats and emits a message if the logger is at or below LogLevelWarning
func (ll *LeveledLogger) Warningf(format string, args ...interface{}) {
ll.logf(ll.warn, LogLevelWarning, format, args...)
// Warnf formats and emits a message if the logger is at or below LogLevelWarn
func (ll *LeveledLogger) Warnf(format string, args ...interface{}) {
ll.logf(ll.warn, LogLevelWarn, format, args...)
}

// Error emits the preformatted message if the logger is at or below LogLevelError
@@ -214,6 +214,6 @@ func NewLeveledLoggerForScope(scope string) *LeveledLogger {
WithTraceLogger(log.New(logger.writer, fmt.Sprintf("%s TRACE: ", scope), log.Lmicroseconds|log.Lshortfile)).
WithDebugLogger(log.New(logger.writer, fmt.Sprintf("%s DEBUG: ", scope), log.Lmicroseconds|log.Lshortfile)).
WithInfoLogger(log.New(logger.writer, fmt.Sprintf("%s INFO: ", scope), log.LstdFlags)).
WithWarningLogger(log.New(logger.writer, fmt.Sprintf("%s WARNING: ", scope), log.LstdFlags)).
WithWarnLogger(log.New(logger.writer, fmt.Sprintf("%s WARNING: ", scope), log.LstdFlags)).
WithErrorLogger(log.New(logger.writer, fmt.Sprintf("%s ERROR: ", scope), log.LstdFlags))
}
4 changes: 2 additions & 2 deletions logging_test.go
Original file line number Diff line number Diff line change
@@ -12,15 +12,15 @@ func TestScopedLogger(t *testing.T) {
var outBuf bytes.Buffer
logger := logging.NewScopedLogger("test1").
WithOutput(&outBuf).
WithLogLevel(logging.LogLevelWarning)
WithLogLevel(logging.LogLevelWarn)

logger.Debug("this shouldn't be logged")
if outBuf.Len() > 0 {
t.Error("Debug was logged when it shouldn't have been")
}

warnMsg := "this is a warning message"
logger.Warning(warnMsg)
logger.Warn(warnMsg)
if !strings.Contains(outBuf.String(), warnMsg) {
t.Errorf("Expected to find %q in %q, but didn't", warnMsg, outBuf.String())
}
10 changes: 5 additions & 5 deletions scoped.go
Original file line number Diff line number Diff line change
@@ -73,11 +73,11 @@ func NewScopedLogger(scope string) *LeveledLogger {

func init() {
logLevels := map[string]LogLevel{
"ERROR": LogLevelError,
"WARNING": LogLevelWarning,
"INFO": LogLevelInfo,
"DEBUG": LogLevelDebug,
"TRACE": LogLevelTrace,
"ERROR": LogLevelError,
"WARN": LogLevelWarn,
"INFO": LogLevelInfo,
"DEBUG": LogLevelDebug,
"TRACE": LogLevelTrace,
}

for name, level := range logLevels {

0 comments on commit 6f36df5

Please sign in to comment.