refactor: use slog instead of log
This commit is contained in:
parent
fcffccc145
commit
d8743e54c1
8 changed files with 180 additions and 165 deletions
|
|
@ -2,7 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"log/slog"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ func loadConfig() (Config, error) {
|
|||
workConfigPath := filepath.Join(configPath, "work")
|
||||
configFile := filepath.Join(workConfigPath, "config.toml")
|
||||
|
||||
if err := os.MkdirAll(workConfigPath, 0750); err != nil {
|
||||
if err := os.MkdirAll(workConfigPath, 0o750); err != nil {
|
||||
return cfg, fmt.Errorf("could not create config directory '%s': %w", workConfigPath, err)
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ func loadConfig() (Config, error) {
|
|||
if _, ok := err.(viper.ConfigFileNotFoundError); !ok {
|
||||
return cfg, fmt.Errorf("error reading config file '%s': %w", configFile, err)
|
||||
}
|
||||
log.Printf("INFO: Config file '%s' not found, using defaults/env vars.", configFile)
|
||||
slog.Info(fmt.Sprintf("Config file '%s' not found, using defaults/env vars.", configFile))
|
||||
}
|
||||
|
||||
if err := viper.UnmarshalKey("default", &cfg); err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue