quiet debugging on Get() and Set()
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
29db278b6a
commit
5fa7681956
5
Makefile
5
Makefile
|
@ -1,5 +1,10 @@
|
|||
# git remote add github git@github.com:wit-go/log.git
|
||||
|
||||
redomod:
|
||||
rm -f go.*
|
||||
unset GO111MODULES && go mod init
|
||||
unset GO111MODULES && go mod tidy
|
||||
|
||||
github:
|
||||
git push origin master
|
||||
git push origin devel
|
||||
|
|
16
flags.go
16
flags.go
|
@ -22,7 +22,9 @@ type LogFlag struct {
|
|||
B bool
|
||||
Default bool // set at the time of Registration()
|
||||
Name string
|
||||
Subsystem string
|
||||
// TODO: figure out what package is sending the Registration
|
||||
Subsystem string // probably should just be forced to be the package name
|
||||
Short string // string actually printed on each line
|
||||
Desc string
|
||||
}
|
||||
|
||||
|
@ -132,11 +134,11 @@ func (f *LogFlag) Set(b bool) {
|
|||
func Set(subsystem string, name string, b bool) {
|
||||
flagsMutex.Lock()
|
||||
defer flagsMutex.Unlock()
|
||||
Info("Set() TODO find var:", "(" + subsystem + ")", name, "=", b)
|
||||
Verbose("log.Set() TODO find var:", "(" + subsystem + ")", name, "=", b)
|
||||
for _, f := range flags {
|
||||
Log(true, "Set() ", "(" + f.Subsystem + ")", f.Name, "=", f.B, ":", f.Desc)
|
||||
Verbose("log.Set() ", "(" + f.Subsystem + ")", f.Name, "=", f.B, ":", f.Desc)
|
||||
if (subsystem == f.Subsystem) && (name == f.Name) {
|
||||
Log(true, "Set() FOUND ", f)
|
||||
Verbose("log.Set() FOUND ", f)
|
||||
f.B = b
|
||||
return
|
||||
}
|
||||
|
@ -147,11 +149,11 @@ func Set(subsystem string, name string, b bool) {
|
|||
func Get(subsystem string, name string) bool {
|
||||
flagsMutex.Lock()
|
||||
defer flagsMutex.Unlock()
|
||||
Info("Get() TODO find var:", "(" + subsystem + ")", name)
|
||||
Verbose("log.Get() TODO find var:", "(" + subsystem + ")", name)
|
||||
for _, f := range flags {
|
||||
Log(true, "Get() ", "(" + f.Subsystem + ")", f.Name, "=", f.B, ":", f.Desc)
|
||||
Verbose("log.Get() ", "(" + f.Subsystem + ")", f.Name, "=", f.B, ":", f.Desc)
|
||||
if (subsystem == f.Subsystem) && (name == f.Name) {
|
||||
Log(true, "Get() FOUND ", f)
|
||||
Verbose("log.Get() FOUND ", f)
|
||||
return f.B
|
||||
}
|
||||
}
|
||||
|
|
2
go.mod
2
go.mod
|
@ -2,4 +2,4 @@ module go.wit.com/log
|
|||
|
||||
go 1.21.4
|
||||
|
||||
require github.com/davecgh/go-spew v1.1.1
|
||||
require go.wit.com/spew v0.0.0-20240101141411-c7b8e91573c9
|
||||
|
|
4
go.sum
4
go.sum
|
@ -1,2 +1,2 @@
|
|||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
go.wit.com/spew v0.0.0-20240101141411-c7b8e91573c9 h1:UEX2EzLQPzLTfy/kUFQD7OXtvKn8wk/+jpDOkbl4ff4=
|
||||
go.wit.com/spew v0.0.0-20240101141411-c7b8e91573c9/go.mod h1:qBpgJXThMMT15vym7/E4Ur9y8oOo2nP7t2RP52QHUNw=
|
||||
|
|
Loading…
Reference in New Issue