Skip to content

Commit

Permalink
Merge pull request golang#13 from michael-berlin/fix_log_before_flag_…
Browse files Browse the repository at this point in the history
…parse

Export glog bugfix.
  • Loading branch information
robpike committed Jul 31, 2015
2 parents 44145f0 + 65d6746 commit fca8c88
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion glog.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
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() {
Expand Down

0 comments on commit fca8c88

Please sign in to comment.