use standard debugger.go file
This commit is contained in:
parent
511ffdcd23
commit
84c1341b8c
|
@ -0,0 +1,26 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
/*
|
||||||
|
enables GUI options and the debugger in your application
|
||||||
|
*/
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go.wit.com/dev/alexflint/arg"
|
||||||
|
"go.wit.com/lib/debugger"
|
||||||
|
"go.wit.com/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
var args struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
arg.MustParse(&args)
|
||||||
|
|
||||||
|
if debugger.ArgDebug() {
|
||||||
|
log.Info("cmd line --debugger == true")
|
||||||
|
go func() {
|
||||||
|
log.Sleep(2)
|
||||||
|
debugger.DebugWindow()
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,25 +1,11 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
/*
|
|
||||||
this parses the command line arguements
|
|
||||||
|
|
||||||
this enables command line options from other packages like 'gui' and 'log'
|
|
||||||
*/
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.wit.com/dev/alexflint/arg"
|
|
||||||
"go.wit.com/lib/debugger"
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var args struct {
|
|
||||||
Display string `arg:"env:DISPLAY"`
|
|
||||||
TmpLog bool `arg:"--tmp-log" help:"automatically send STDOUT to /tmp"`
|
|
||||||
VerboseDNS bool `arg:"--verbose-dns" help:"debug your dns settings"`
|
|
||||||
}
|
|
||||||
|
|
||||||
var NOW *log.LogFlag
|
var NOW *log.LogFlag
|
||||||
var INFO *log.LogFlag
|
var INFO *log.LogFlag
|
||||||
var NET *log.LogFlag
|
var NET *log.LogFlag
|
||||||
|
@ -32,7 +18,6 @@ var CHANGE *log.LogFlag
|
||||||
var STATUS *log.LogFlag
|
var STATUS *log.LogFlag
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
arg.MustParse(&args)
|
|
||||||
full := "go.wit.com/control-panels/dns"
|
full := "go.wit.com/control-panels/dns"
|
||||||
short := "cpdns"
|
short := "cpdns"
|
||||||
|
|
||||||
|
@ -47,12 +32,6 @@ func init() {
|
||||||
CHANGE = log.NewFlag("CHANGE", true, full, short, "when host or dns change")
|
CHANGE = log.NewFlag("CHANGE", true, full, short, "when host or dns change")
|
||||||
STATUS = log.NewFlag("STATUS", false, full, short, "updateStatus() polling")
|
STATUS = log.NewFlag("STATUS", false, full, short, "updateStatus() polling")
|
||||||
|
|
||||||
if debugger.ArgDebug() {
|
|
||||||
log.Log(NOW, "INIT() gui debug == true")
|
|
||||||
} else {
|
|
||||||
log.Log(NOW, "INIT() gui debug == false")
|
|
||||||
}
|
|
||||||
|
|
||||||
me.dnsSleep = 500 * time.Millisecond
|
me.dnsSleep = 500 * time.Millisecond
|
||||||
me.localSleep = 100 * time.Millisecond
|
me.localSleep = 100 * time.Millisecond
|
||||||
|
|
5
main.go
5
main.go
|
@ -35,11 +35,6 @@ func main() {
|
||||||
me.ipv4s = make(map[string]dns.RR)
|
me.ipv4s = make(map[string]dns.RR)
|
||||||
me.ipv6s = make(map[string]dns.RR)
|
me.ipv6s = make(map[string]dns.RR)
|
||||||
|
|
||||||
if args.TmpLog {
|
|
||||||
// send all log() output to a file in /tmp
|
|
||||||
log.SetTmp()
|
|
||||||
}
|
|
||||||
|
|
||||||
me.myGui = gui.New()
|
me.myGui = gui.New()
|
||||||
me.myGui.InitEmbed(resToolkit)
|
me.myGui.InitEmbed(resToolkit)
|
||||||
me.myGui.Default()
|
me.myGui.Default()
|
||||||
|
|
Loading…
Reference in New Issue