summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-07-19 21:11:33 +0200
committerRobin Jarry <robin@jarry.cc>2022-07-23 22:52:20 +0200
commit9203c4b6ef95b324336a9f023550b64a9eb1e4a8 (patch)
treebf3579fb0f9e99266b056a6dcd52642974f1a3c6
parentcd1999555714fb886493d2d04b6c472be55cebef (diff)
downloadaerc-9203c4b6ef95b324336a9f023550b64a9eb1e4a8.zip
logging: print init procedure and config contents
This may help debugging issues. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
-rw-r--r--aerc.go4
-rw-r--r--config/config.go30
2 files changed, 29 insertions, 5 deletions
diff --git a/aerc.go b/aerc.go
index 909d8e9..cd8c4da 100644
--- a/aerc.go
+++ b/aerc.go
@@ -95,15 +95,19 @@ func usage(msg string) {
}
func setWindowTitle() {
+ logging.Debugf("Parsing terminfo")
ti, err := terminfo.LoadFromEnv()
if err != nil {
+ logging.Warnf("Cannot get terminfo: %v", err)
return
}
if !ti.Has(terminfo.HasStatusLine) {
+ logging.Infof("Terminal does not have status line support")
return
}
+ logging.Infof("Setting terminal title")
buf := new(bytes.Buffer)
ti.Fprintf(buf, terminfo.ToStatusLine)
fmt.Fprint(buf, "aerc")
diff --git a/config/config.go b/config/config.go
index 22bbe2b..6a8be10 100644
--- a/config/config.go
+++ b/config/config.go
@@ -659,11 +659,14 @@ func LoadConfigFromFile(root *string) (*AercConfig, error) {
// if it doesn't exist copy over the template, then load
if _, err := os.Stat(filename); errors.Is(err, os.ErrNotExist) {
+ logging.Debugf("%s not found, installing the system default", filename)
if err := installTemplate(*root, "aerc.conf"); err != nil {
return nil, err
}
}
+ logging.Infof("Parsing configuration from %s", filename)
+
file, err := ini.LoadSources(ini.LoadOptions{
KeyValueDelimiters: "=",
}, filename)
@@ -788,6 +791,15 @@ func LoadConfigFromFile(root *string) (*AercConfig, error) {
}
}
+ logging.Debugf("aerc.conf: [general] %#v", config.General)
+ logging.Debugf("aerc.conf: [ui] %#v", config.Ui)
+ logging.Debugf("aerc.conf: [statusline] %#v", config.Statusline)
+ logging.Debugf("aerc.conf: [viewer] %#v", config.Viewer)
+ logging.Debugf("aerc.conf: [compose] %#v", config.Compose)
+ logging.Debugf("aerc.conf: [filters] %#v", config.Filters)
+ logging.Debugf("aerc.conf: [triggers] %#v", config.Triggers)
+ logging.Debugf("aerc.conf: [templates] %#v", config.Templates)
+
filename = path.Join(*root, "accounts.conf")
if !config.General.UnsafeAccountsConf {
if err := checkConfigPerms(filename); err != nil {
@@ -796,21 +808,28 @@ func LoadConfigFromFile(root *string) (*AercConfig, error) {
}
accountsPath := path.Join(*root, "accounts.conf")
+ logging.Infof("Parsing accounts configuration from %s", accountsPath)
if accounts, err := loadAccountConfig(accountsPath); err != nil {
return nil, err
} else {
config.Accounts = accounts
}
+ for _, acct := range config.Accounts {
+ logging.Debugf("accounts.conf: [%s] from = %s", acct.Name, acct.From)
+ }
+
filename = path.Join(*root, "binds.conf")
- binds, err := ini.Load(filename)
- if err != nil {
+ if _, err := os.Stat(filename); errors.Is(err, os.ErrNotExist) {
+ logging.Debugf("%s not found, installing the system default", filename)
if err := installTemplate(*root, "binds.conf"); err != nil {
return nil, err
}
- if binds, err = ini.Load(filename); err != nil {
- return nil, err
- }
+ }
+ logging.Infof("Parsing key bindings configuration from %s", filename)
+ binds, err := ini.Load(filename)
+ if err != nil {
+ return nil, err
}
baseGroups := map[string]**KeyBindings{
@@ -851,6 +870,7 @@ func LoadConfigFromFile(root *string) (*AercConfig, error) {
contextBind.Bindings.Globals = false
}
}
+ logging.Debugf("binds.conf: %#v", config.Bindings)
return config, nil
}