mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-04 07:29:56 +08:00
21 lines
430 B
Go
21 lines
430 B
Go
//go:build windows && !production
|
|
|
|
package application
|
|
|
|
import (
|
|
"github.com/lmittmann/tint"
|
|
"github.com/mattn/go-colorable"
|
|
"github.com/mattn/go-isatty"
|
|
"log/slog"
|
|
"os"
|
|
"time"
|
|
)
|
|
|
|
func DefaultLogger(level slog.Level) *slog.Logger {
|
|
return slog.New(tint.NewHandler(colorable.NewColorable(os.Stderr), &tint.Options{
|
|
TimeFormat: time.StampMilli,
|
|
NoColor: !isatty.IsTerminal(os.Stderr.Fd()),
|
|
Level: level,
|
|
}))
|
|
}
|