@@ -1613,13 +1613,13 @@ void LogMessage::Init(const char* file,
16131613 // (log level, GMT year, month, date, time, thread_id, file basename, line)
16141614 // We exclude the thread_id for the default thread.
16151615 if (FLAGS_log_prefix && (line != kNoLogPrefix )) {
1616+ std::ios saved_fmt (NULL );
1617+ saved_fmt.copyfmt (stream ());
1618+ stream ().fill (' 0' );
16161619 #ifdef GLOG_CUSTOM_PREFIX_SUPPORT
16171620 if (custom_prefix_callback == NULL ) {
16181621 #endif
1619- std::ios saved_fmt (NULL );
1620- saved_fmt.copyfmt (stream ());
1621- stream () << setfill (' 0' )
1622- << LogSeverityNames[severity][0 ]
1622+ stream () << LogSeverityNames[severity][0 ]
16231623 << setw (4 ) << 1900 +data_->tm_time_ .tm_year
16241624 << setw (2 ) << 1 +data_->tm_time_ .tm_mon
16251625 << setw (2 ) << data_->tm_time_ .tm_mday
@@ -1633,7 +1633,6 @@ void LogMessage::Init(const char* file,
16331633 << static_cast <unsigned int >(GetTID ()) << setfill (' 0' )
16341634 << ' '
16351635 << data_->basename_ << ' :' << data_->line_ << " ] " ;
1636- stream ().copyfmt (saved_fmt);
16371636 #ifdef GLOG_CUSTOM_PREFIX_SUPPORT
16381637 } else {
16391638 custom_prefix_callback (
@@ -1648,6 +1647,7 @@ void LogMessage::Init(const char* file,
16481647 stream () << " " ;
16491648 }
16501649 #endif
1650+ stream ().copyfmt (saved_fmt);
16511651 }
16521652 data_->num_prefix_chars_ = data_->stream_ .pcount ();
16531653
0 commit comments