2023-02-18 23:37:11 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2023-12-16 09:02:59 -06:00
|
|
|
"log"
|
2023-12-20 03:13:43 -06:00
|
|
|
"reflect"
|
2023-03-25 08:09:34 -05:00
|
|
|
witlog "git.wit.org/wit/gui/log"
|
2023-02-18 23:37:11 -06:00
|
|
|
)
|
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
var LogPrefix = "ipv6cp" // ipv6 control panel debugging line
|
|
|
|
|
2023-03-25 08:09:34 -05:00
|
|
|
// various debugging flags
|
2023-12-20 03:13:43 -06:00
|
|
|
var DEBUGON bool = true
|
|
|
|
var LogNow bool = true // useful for active development
|
|
|
|
var LogError bool = true // probably always leave this one
|
|
|
|
var LogChange bool = true // turn on /proc debugging output
|
|
|
|
|
|
|
|
var LogInfo bool = false // general info
|
|
|
|
var LogNet bool = false // general network debugging
|
|
|
|
var LogProc bool = false // turn on /proc debugging output
|
|
|
|
var LogExec bool = false // turn on os.Exec() debugging
|
2023-02-18 23:37:11 -06:00
|
|
|
|
2023-03-25 08:09:34 -05:00
|
|
|
var SPEW witlog.Spewt
|
2023-02-18 23:37:11 -06:00
|
|
|
|
2023-03-25 08:09:34 -05:00
|
|
|
// var log interface{}
|
2023-02-18 23:37:11 -06:00
|
|
|
|
2023-12-16 09:02:59 -06:00
|
|
|
/*
|
2023-03-25 08:09:34 -05:00
|
|
|
func log(a ...any) {
|
|
|
|
witlog.Where = "wit/gui"
|
|
|
|
witlog.Log(a...)
|
|
|
|
}
|
2023-12-16 09:02:59 -06:00
|
|
|
*/
|
2023-02-18 23:37:11 -06:00
|
|
|
|
|
|
|
func sleep(a ...any) {
|
2023-03-25 08:09:34 -05:00
|
|
|
witlog.Sleep(a...)
|
2023-02-18 23:37:11 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func exit(a ...any) {
|
2023-12-20 03:13:43 -06:00
|
|
|
debug(LogError, "got to log() exit")
|
2023-03-25 08:09:34 -05:00
|
|
|
witlog.Exit(a...)
|
2023-02-18 23:37:11 -06:00
|
|
|
}
|
2023-12-20 03:13:43 -06:00
|
|
|
|
|
|
|
func debug(a ...any) {
|
|
|
|
if (! DEBUGON) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if (a == nil) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var tbool bool
|
|
|
|
if (reflect.TypeOf(a[0]) == reflect.TypeOf(tbool)) {
|
|
|
|
if (a[0] == false) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
a[0] = LogPrefix // ipv6 control panel debugging line
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Println(a...)
|
|
|
|
}
|