Skip to content

Commit

Permalink
add deprecate marks
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Okhlopkov <[email protected]>
  • Loading branch information
Pavel Okhlopkov committed Oct 22, 2024
1 parent a4d9751 commit 606684d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/unilogger/global.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// global logger is deprecated
package unilogger

import (
Expand Down
7 changes: 7 additions & 0 deletions pkg/unilogger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,33 +149,39 @@ func (l *Logger) Trace(msg string, args ...any) {
l.Log(ctx, LevelTrace.Level(), msg, args...)
}

// deprecated
func (l *Logger) Tracef(format string, args ...any) {
ctx := logContext.SetCustomKeyContext(context.Background())
ctx = logContext.SetStackTraceContext(ctx, getStack())

l.Log(ctx, LevelTrace.Level(), fmt.Sprintf(format, args...))
}

// deprecated
func (l *Logger) Logf(ctx context.Context, level Level, format string, args ...any) {
ctx = logContext.SetCustomKeyContext(ctx)
l.Log(ctx, level.Level(), fmt.Sprintf(format, args...))
}

// deprecated
func (l *Logger) Debugf(format string, args ...any) {
ctx := logContext.SetCustomKeyContext(context.Background())
l.Log(ctx, LevelDebug.Level(), fmt.Sprintf(format, args...))
}

// deprecated
func (l *Logger) Infof(format string, args ...any) {
ctx := logContext.SetCustomKeyContext(context.Background())
l.Log(ctx, LevelInfo.Level(), fmt.Sprintf(format, args...))
}

// deprecated
func (l *Logger) Warnf(format string, args ...any) {
ctx := logContext.SetCustomKeyContext(context.Background())
l.Log(ctx, LevelWarn.Level(), fmt.Sprintf(format, args...))
}

// deprecated
func (l *Logger) Errorf(format string, args ...any) {
ctx := logContext.SetCustomKeyContext(context.Background())
l.Log(ctx, LevelError.Level(), fmt.Sprintf(format, args...))
Expand All @@ -190,6 +196,7 @@ func (l *Logger) Fatal(msg string, args ...any) {
os.Exit(1)
}

// deprecated
func (l *Logger) Fatalf(format string, args ...any) {
ctx := logContext.SetCustomKeyContext(context.Background())
ctx = logContext.SetStackTraceContext(ctx, getStack())
Expand Down

0 comments on commit 606684d

Please sign in to comment.