Skip to content

Commit

Permalink
fix: var name
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed Mar 4, 2024
1 parent cbe8465 commit 6b0a990
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion context.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func FromContext(ctx context.Context) *Logger {
if logger, ok := ctx.Value(ContextKey).(*Logger); ok {
return logger
}
return defaultLogger
return Default()
}

type contextKey struct{ string }
Expand Down
7 changes: 3 additions & 4 deletions pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ var (
// registry is a map of all registered lipgloss renderers.
registry = sync.Map{}

initDefaultOnce sync.Once

// defaultLogger is the default global logger instance.
defaultLogger *Logger
defaultLoggerOnce sync.Once
defaultLogger *Logger
)

// Default returns the default logger. The default logger comes with timestamp enabled.
func Default() *Logger {
initDefaultOnce.Do(func() {
defaultLoggerOnce.Do(func() {
if defaultLogger != nil {
// already set via SetDefault.
return
Expand Down

0 comments on commit 6b0a990

Please sign in to comment.