Skip to content

Commit 0cab6a1

Browse files
committed
feat: Add utils for slog
1 parent c1a8309 commit 0cab6a1

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

alteriso/src/internal/archiso/profile_struct.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ type ProfileDef struct {
1717
Injects map[string][]string `json:"injects"`
1818
COWSpaceSize string `json:"cow_spacesize"`
1919
RequireInjectable bool `json:"require_injectable"`
20+
PacmanConf string `json:"pacman_conf"`
2021
}

alteriso/src/internal/logger/log.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,10 @@ func UseColorLog(level slog.Level) {
4242
func init() {
4343
UseColorLog(slog.LevelDebug)
4444
}
45+
46+
func WithoutLog(f func() error) error {
47+
prev := slog.Default()
48+
slog.SetDefault(slog.New(slog.DiscardHandler))
49+
defer slog.SetDefault(prev)
50+
return f()
51+
}

0 commit comments

Comments
 (0)