Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/pion/logging

go 1.21
go 1.24

require github.com/stretchr/testify v1.11.1

Expand Down
10 changes: 5 additions & 5 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (ll *DefaultLeveledLogger) SetLevel(newLevel LogLevel) {

// Trace emits the preformatted message if the logger is at or below LogLevelTrace.
func (ll *DefaultLeveledLogger) Trace(msg string) {
ll.logf(ll.trace, LogLevelTrace, msg) // nolint: govet
ll.logf(ll.trace, LogLevelTrace, "%s", msg)
}

// Tracef formats and emits a message if the logger is at or below LogLevelTrace.
Expand All @@ -122,7 +122,7 @@ func (ll *DefaultLeveledLogger) Tracef(format string, args ...any) {

// Debug emits the preformatted message if the logger is at or below LogLevelDebug.
func (ll *DefaultLeveledLogger) Debug(msg string) {
ll.logf(ll.debug, LogLevelDebug, msg) // nolint: govet
ll.logf(ll.debug, LogLevelDebug, "%s", msg)
}

// Debugf formats and emits a message if the logger is at or below LogLevelDebug.
Expand All @@ -132,7 +132,7 @@ func (ll *DefaultLeveledLogger) Debugf(format string, args ...any) {

// Info emits the preformatted message if the logger is at or below LogLevelInfo.
func (ll *DefaultLeveledLogger) Info(msg string) {
ll.logf(ll.info, LogLevelInfo, msg) // nolint: govet
ll.logf(ll.info, LogLevelInfo, "%s", msg)
}

// Infof formats and emits a message if the logger is at or below LogLevelInfo.
Expand All @@ -142,7 +142,7 @@ func (ll *DefaultLeveledLogger) Infof(format string, args ...any) {

// Warn emits the preformatted message if the logger is at or below LogLevelWarn.
func (ll *DefaultLeveledLogger) Warn(msg string) {
ll.logf(ll.warn, LogLevelWarn, msg) // nolint: govet
ll.logf(ll.warn, LogLevelWarn, "%s", msg)
}

// Warnf formats and emits a message if the logger is at or below LogLevelWarn.
Expand All @@ -152,7 +152,7 @@ func (ll *DefaultLeveledLogger) Warnf(format string, args ...any) {

// Error emits the preformatted message if the logger is at or below LogLevelError.
func (ll *DefaultLeveledLogger) Error(msg string) {
ll.logf(ll.err, LogLevelError, msg) // nolint: govet
ll.logf(ll.err, LogLevelError, "%s", msg)
}

// Errorf formats and emits a message if the logger is at or below LogLevelError.
Expand Down
10 changes: 5 additions & 5 deletions logging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func testDebugLevel(t *testing.T, logger *logging.DefaultLeveledLogger) {
assert.Truef(t, strings.Contains(outBuf.String(), dbgMsg),
"Expected to find %q in %q, but didn't", dbgMsg, outBuf.String())

logger.Debugf(dbgMsg) // nolint: govet
logger.Debugf("%s", dbgMsg)
assert.Truef(t, strings.Contains(outBuf.String(), dbgMsg),
"Expected to find %q in %q, but didn't", dbgMsg, outBuf.String())
}
Expand All @@ -55,7 +55,7 @@ func testWarnLevel(t *testing.T, logger *logging.DefaultLeveledLogger) {
assert.Truef(t, strings.Contains(outBuf.String(), warnMsg),
"Expected to find %q in %q, but didn't", warnMsg, outBuf.String())

logger.Warnf(warnMsg) // nolint: govet
logger.Warnf("%s", warnMsg)
assert.Truef(t, strings.Contains(outBuf.String(), warnMsg),
"Expected to find %q in %q, but didn't", warnMsg, outBuf.String())
}
Expand All @@ -71,7 +71,7 @@ func testErrorLevel(t *testing.T, logger *logging.DefaultLeveledLogger) {
assert.Truef(t, strings.Contains(outBuf.String(), errMsg),
"Expected to find %q in %q but didn't", errMsg, outBuf.String())

logger.Errorf(errMsg) // nolint: govet
logger.Errorf("%s", errMsg)
assert.Truef(t, strings.Contains(outBuf.String(), errMsg),
"Expected to find %q in %q but didn't", errMsg, outBuf.String())
}
Expand All @@ -87,7 +87,7 @@ func testTraceLevel(t *testing.T, logger *logging.DefaultLeveledLogger) {
assert.Truef(t, strings.Contains(outBuf.String(), traceMsg),
"Expected to find %q in %q but didn't", traceMsg, outBuf.String())

logger.Tracef(traceMsg) // nolint: govet
logger.Tracef("%s", traceMsg)
assert.Truef(t, strings.Contains(outBuf.String(), traceMsg),
"Expected to find %q in %q but didn't", traceMsg, outBuf.String())
}
Expand All @@ -103,7 +103,7 @@ func testInfoLevel(t *testing.T, logger *logging.DefaultLeveledLogger) {
assert.Truef(t, strings.Contains(outBuf.String(), infoMsg),
"Expected to find %q in %q but didn't", infoMsg, outBuf.String())

logger.Infof(infoMsg) // nolint: govet
logger.Infof("%s", infoMsg)
assert.Truef(t, strings.Contains(outBuf.String(), infoMsg),
"Expected to find %q in %q but didn't", infoMsg, outBuf.String())
}
Expand Down
Loading