use Short if defined

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-06 17:10:59 -06:00
parent 5fa7681956
commit 6749a1d173
2 changed files with 4 additions and 1 deletions

View File

@ -120,6 +120,9 @@ func (f *LogFlag) Register() {
defer flagsMutex.Unlock() defer flagsMutex.Unlock()
Info("log.Register() ", f) Info("log.Register() ", f)
f.Default = f.B f.Default = f.B
if f.Short == "" {
f.Short = f.Subsystem
}
flags = append(flags,f) flags = append(flags,f)
} }

2
log.go
View File

@ -34,7 +34,7 @@ func Log(x any, a ...any) {
if ! f.B { if ! f.B {
return return
} }
a = append([]any{f.Subsystem}, a...) a = append([]any{f.Short}, a...)
origlog.Println(a...) origlog.Println(a...)
default: default:
a = append([]any{x}, a...) a = append([]any{x}, a...)