diff --git a/go.mod b/go.mod index 0ea7cee..3b51d9d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/pion/logging -go 1.21 +go 1.24 require github.com/stretchr/testify v1.11.1 diff --git a/logger.go b/logger.go index 61002bc..3af89fe 100644 --- a/logger.go +++ b/logger.go @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. diff --git a/logging_test.go b/logging_test.go index 938c3fa..28865e2 100644 --- a/logging_test.go +++ b/logging_test.go @@ -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()) } @@ -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()) } @@ -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()) } @@ -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()) } @@ -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()) }