5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-04 09:21:44 +08:00
wails/v3/pkg/application/logger_dev.go
Lea Anthony e5c14d24ae
Initial implementation of dev mode.
Huge thanks to @atterpac!
2024-01-19 21:34:49 +11:00

21 lines
372 B
Go

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