nocui works correctly
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
7371f0428f
commit
53f2462b32
8
flags.go
8
flags.go
|
@ -40,6 +40,7 @@ var ERROR *LogFlag // toggles log.Warn() (true by default)
|
|||
var PRINTLN *LogFlag // toggles log.Println() (true by default)
|
||||
|
||||
var always *LogFlag
|
||||
var allon bool = false
|
||||
|
||||
// writeMutex protects locks the write process
|
||||
var flagsMutex sync.Mutex
|
||||
|
@ -103,6 +104,7 @@ func (f *LogFlag) Ok() bool {
|
|||
func SetAll(b bool) {
|
||||
flagsMutex.Lock()
|
||||
defer flagsMutex.Unlock()
|
||||
allon = b
|
||||
for _, f := range flags {
|
||||
f.b = b
|
||||
}
|
||||
|
@ -187,7 +189,11 @@ func NewFlag(name string, b bool, full, short, desc string) *LogFlag {
|
|||
defer flagsMutex.Unlock()
|
||||
f := new(LogFlag)
|
||||
Log(always, "log.SetFlag() ", full, short, name, true)
|
||||
f.b = b
|
||||
if allon {
|
||||
f.b = true
|
||||
} else {
|
||||
f.b = b
|
||||
}
|
||||
f.orig = b
|
||||
f.short = short
|
||||
f.subsystem = full
|
||||
|
|
Loading…
Reference in New Issue