5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-06 08:21:42 +08:00
wails/v3/pkg/application/logger_dev_windows.go
2025-02-13 03:11:21 +01:00

22 lines
433 B
Go

//go:build windows && !production
package application
import (
"log/slog"
"os"
"time"
"github.com/lmittmann/tint"
"github.com/mattn/go-colorable"
"github.com/mattn/go-isatty"
)
func DefaultLogger(level slog.Leveler) *slog.Logger {
return slog.New(tint.NewHandler(colorable.NewColorable(os.Stderr), &tint.Options{
TimeFormat: time.StampMilli,
NoColor: !isatty.IsTerminal(os.Stderr.Fd()),
Level: level,
}))
}