aboutsummaryrefslogtreecommitdiffstats
path: root/config/general.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-11-27 11:29:34 +0100
committerRobin Jarry <robin@jarry.cc>2022-12-02 22:10:49 +0100
commit23a05d17ac1d23466ff73efa19576d43d06efe4b (patch)
tree49986587a62bdd89eb06ffa2aadf05f6d45cb3e7 /config/general.go
parent70f46757449c8f24b818f4dfc5dcb87da7e327d6 (diff)
downloadaerc-23a05d17ac1d23466ff73efa19576d43d06efe4b.tar.gz
logging: rename package to log
Use the same name than the builtin "log" package. That way, we do not risk logging in the wrong place. Suggested-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'config/general.go')
-rw-r--r--config/general.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/config/general.go b/config/general.go
index 2a462a3e..8ca22471 100644
--- a/config/general.go
+++ b/config/general.go
@@ -4,25 +4,25 @@ import (
"fmt"
"os"
- "git.sr.ht/~rjarry/aerc/logging"
+ "git.sr.ht/~rjarry/aerc/log"
"github.com/go-ini/ini"
"github.com/mattn/go-isatty"
"github.com/mitchellh/go-homedir"
)
type GeneralConfig struct {
- DefaultSavePath string `ini:"default-save-path"`
- PgpProvider string `ini:"pgp-provider"`
- UnsafeAccountsConf bool `ini:"unsafe-accounts-conf"`
- LogFile string `ini:"log-file"`
- LogLevel logging.LogLevel `ini:"-"`
+ DefaultSavePath string `ini:"default-save-path"`
+ PgpProvider string `ini:"pgp-provider"`
+ UnsafeAccountsConf bool `ini:"unsafe-accounts-conf"`
+ LogFile string `ini:"log-file"`
+ LogLevel log.LogLevel `ini:"-"`
}
func defaultGeneralConfig() GeneralConfig {
return GeneralConfig{
PgpProvider: "internal",
UnsafeAccountsConf: false,
- LogLevel: logging.INFO,
+ LogLevel: log.INFO,
}
}
@@ -39,7 +39,7 @@ func (config *AercConfig) parseGeneral(file *ini.File) error {
}
level, err = gen.GetKey("log-level")
if err == nil {
- l, err := logging.ParseLevel(level.String())
+ l, err := log.ParseLevel(level.String())
if err != nil {
return err
}
@@ -52,7 +52,7 @@ end:
if !isatty.IsTerminal(os.Stdout.Fd()) {
logFile = os.Stdout
// redirected to file, force DEBUG level
- config.General.LogLevel = logging.DEBUG
+ config.General.LogLevel = log.DEBUG
} else if config.General.LogFile != "" {
path, err := homedir.Expand(config.General.LogFile)
if err != nil {
@@ -64,8 +64,8 @@ end:
return fmt.Errorf("log-file: %w", err)
}
}
- logging.Init(logFile, config.General.LogLevel)
- logging.Debugf("aerc.conf: [general] %#v", config.General)
+ log.Init(logFile, config.General.LogLevel)
+ log.Debugf("aerc.conf: [general] %#v", config.General)
return nil
}