aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/aerc/main.go23
1 files changed, 22 insertions, 1 deletions
diff --git a/cmd/aerc/main.go b/cmd/aerc/main.go
index e33f158f..cda49911 100644
--- a/cmd/aerc/main.go
+++ b/cmd/aerc/main.go
@@ -1,13 +1,30 @@
package main
import (
+ "fmt"
+ "io"
+ "io/ioutil"
+ "log"
+ "os"
"time"
+ "github.com/mattn/go-isatty"
+
"git.sr.ht/~sircmpwn/aerc2/config"
"git.sr.ht/~sircmpwn/aerc2/ui"
)
func main() {
+ var logOut io.Writer
+ var logger *log.Logger
+ if !isatty.IsTerminal(os.Stdout.Fd()) {
+ logOut = os.Stdout
+ } else {
+ logOut = ioutil.Discard
+ }
+ logger = log.New(logOut, "", log.LstdFlags|log.Lshortfile)
+ logger.Println("Starting up aerc")
+
conf, err := config.LoadConfig(nil)
if err != nil {
panic(err)
@@ -18,7 +35,11 @@ func main() {
}
defer _ui.Close()
for _, account := range conf.Accounts {
- tab, err := ui.NewAccountTab(&account)
+ logger.Printf("Initializing account %s\n", account.Name)
+ tab, err := ui.NewAccountTab(&account, log.New(
+ logOut,
+ fmt.Sprintf("[%s] ", account.Name),
+ log.LstdFlags|log.Lshortfile))
if err != nil {
panic(err)
}