attempt at log.ListAll()
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
f98207af0a
commit
dd09a7c3ab
20
flags.go
20
flags.go
|
@ -11,6 +11,12 @@ var ERROR bool = true
|
||||||
var VERBOSE bool = false
|
var VERBOSE bool = false
|
||||||
var SPEW bool = false
|
var SPEW bool = false
|
||||||
|
|
||||||
|
var registered map[string][]string
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
registered = make(map[string][]string)
|
||||||
|
}
|
||||||
|
|
||||||
func All(b bool) {
|
func All(b bool) {
|
||||||
Set("SPEW", b)
|
Set("SPEW", b)
|
||||||
Set("INFO", b)
|
Set("INFO", b)
|
||||||
|
@ -19,12 +25,9 @@ func All(b bool) {
|
||||||
Set("VERBOSE", b)
|
Set("VERBOSE", b)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ListAll() []string {
|
func ListAll() map[string][]string {
|
||||||
var all []string
|
registered["all"] = []string{"SPEW","INFO", "WARN", "ERROR", "VERBOSE"}
|
||||||
|
return registered
|
||||||
all = []string{"SPEW","INFO", "WARN", "ERROR", "VERBOSE"}
|
|
||||||
|
|
||||||
return all
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Set(flag string, b bool) {
|
func Set(flag string, b bool) {
|
||||||
|
@ -64,6 +67,7 @@ func Get(flag string) bool {
|
||||||
|
|
||||||
// register a variable name from a subsystem
|
// register a variable name from a subsystem
|
||||||
// this is used for custom log flags
|
// this is used for custom log flags
|
||||||
func Register(subsystem string, name string) {
|
func Register(subsystem string, name string, b *bool) {
|
||||||
Info("log.Register() got subsystem", subsystem, "with name =", name)
|
Info("log.Register() got subsystem", subsystem, "with name =", name, "bool value =", b)
|
||||||
|
registered[subsystem] = append(registered[subsystem], name)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue