supabase-operator/magefiles/common.go

31 lines
460 B
Go
Raw Normal View History

2024-12-10 07:43:59 +00:00
package main
import (
"log/slog"
"os"
_ "github.com/magefile/mage/sh"
)
var workingDir string
func init() {
logLevel := new(slog.LevelVar)
if val, set := os.LookupEnv("MAGE_LOG_LEVEL"); set {
_ = logLevel.UnmarshalText([]byte(val))
}
handler := slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{
Level: logLevel,
})
slog.SetDefault(slog.New(handler))
if wd, err := os.Getwd(); err != nil {
panic(err)
} else {
workingDir = wd
}
}