initial commit
This commit is contained in:
commit
734e1b22f9
11 changed files with 201 additions and 0 deletions
magefiles
30
magefiles/common.go
Normal file
30
magefiles/common.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
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
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue