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 SPEW bool = false
|
||||
|
||||
var registered map[string][]string
|
||||
|
||||
func init() {
|
||||
registered = make(map[string][]string)
|
||||
}
|
||||
|
||||
func All(b bool) {
|
||||
Set("SPEW", b)
|
||||
Set("INFO", b)
|
||||
|
@ -19,12 +25,9 @@ func All(b bool) {
|
|||
Set("VERBOSE", b)
|
||||
}
|
||||
|
||||
func ListAll() []string {
|
||||
var all []string
|
||||
|
||||
all = []string{"SPEW","INFO", "WARN", "ERROR", "VERBOSE"}
|
||||
|
||||
return all
|
||||
func ListAll() map[string][]string {
|
||||
registered["all"] = []string{"SPEW","INFO", "WARN", "ERROR", "VERBOSE"}
|
||||
return registered
|
||||
}
|
||||
|
||||
func Set(flag string, b bool) {
|
||||
|
@ -64,6 +67,7 @@ func Get(flag string) bool {
|
|||
|
||||
// register a variable name from a subsystem
|
||||
// this is used for custom log flags
|
||||
func Register(subsystem string, name string) {
|
||||
Info("log.Register() got subsystem", subsystem, "with name =", name)
|
||||
func Register(subsystem string, name string, b *bool) {
|
||||
Info("log.Register() got subsystem", subsystem, "with name =", name, "bool value =", b)
|
||||
registered[subsystem] = append(registered[subsystem], name)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue