Skip to content

Commit

Permalink
Add lock to loglevel changes
Browse files Browse the repository at this point in the history
  • Loading branch information
leaanthony committed Nov 23, 2024
1 parent 63e1f3c commit f8b7326
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions v2/internal/logger/default_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ package logger
import (
"fmt"
"os"
"sync"

"github.com/wailsapp/wails/v2/pkg/logger"
)

// LogLevel is an alias for the public LogLevel
type LogLevel = logger.LogLevel

var logLevelLock sync.Mutex

// Logger is a utlility to log messages to a number of destinations
type Logger struct {
output logger.Logger
Expand Down Expand Up @@ -45,6 +48,8 @@ func (l *Logger) HideLogLevel() {

// SetLogLevel sets the minimum level of logs that will be output
func (l *Logger) SetLogLevel(level LogLevel) {
logLevelLock.Lock()
defer logLevelLock.Unlock()
l.logLevel = level
}

Expand Down

0 comments on commit f8b7326

Please sign in to comment.