aboutsummaryrefslogtreecommitdiff
path: root/gomuks.go
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-04-01 10:05:29 +0300
committerTulir Asokan <tulir@maunium.net>2018-04-02 13:47:20 +0300
commitdd89fa621d6824edf96c61e47099f1c6ad0bfd09 (patch)
treedcdd2b703c6476979eac25cffb6b8302cb444422 /gomuks.go
parentc6e9f498a4d4c12460c73d8d3358742ed60b7816 (diff)
Improve debug output options
Diffstat (limited to 'gomuks.go')
-rw-r--r--gomuks.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/gomuks.go b/gomuks.go
index 0840bfe..f252fc4 100644
--- a/gomuks.go
+++ b/gomuks.go
@@ -43,7 +43,7 @@ type Gomuks struct {
// NewGomuks creates a new Gomuks instance with everything initialized,
// but does not start it.
-func NewGomuks(enableDebug bool) *Gomuks {
+func NewGomuks(enableDebug, forceExternalDebug bool) *Gomuks {
configDir := filepath.Join(os.Getenv("HOME"), ".config/gomuks")
gmx := &Gomuks{
app: tview.NewApplication(),
@@ -70,7 +70,11 @@ func NewGomuks(enableDebug bool) *Gomuks {
main := gmx.ui.InitViews()
if enableDebug {
debug.EnableExternal()
- main = gmx.debug.Wrap(main)
+ if forceExternalDebug {
+ debug.RedirectAllExt = true
+ } else {
+ main = gmx.debug.Wrap(main, debug.Right)
+ }
gmx.debugMode = true
}
gmx.app.SetRoot(main, true)
@@ -166,8 +170,8 @@ func (gmx *Gomuks) UI() ifc.GomuksUI {
}
func main() {
- enableDebug := len(os.Getenv("DEBUG")) > 0
- NewGomuks(enableDebug).Start()
+ debugVar := os.Getenv("DEBUG")
+ NewGomuks(len(debugVar) > 0, debugVar == "ext").Start()
// We use os.Exit() everywhere, so exiting by returning from Start() shouldn't happen.
time.Sleep(5 * time.Second)