-
Notifications
You must be signed in to change notification settings - Fork 910
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from michael-berlin/fix_log_before_flag_parse
Export glog bugfix.
- Loading branch information
Showing
1 changed file
with
4 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -676,7 +676,10 @@ func (l *loggingT) output(s severity, buf *buffer, file string, line int, alsoTo | |
} | ||
} | ||
data := buf.Bytes() | ||
if l.toStderr { | ||
if !flag.Parsed() { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
absolute8511
|
||
os.Stderr.Write([]byte("ERROR: logging before flag.Parse: ")) | ||
os.Stderr.Write(data) | ||
} else if l.toStderr { | ||
os.Stderr.Write(data) | ||
} else { | ||
if alsoToStderr || l.alsoToStderr || s >= l.stderrThreshold.get() { | ||
|
This will stop user to use 3rd party flag, such as
github.com/spf13/pflag