@ -49,7 +49,7 @@ LogBuffer::LogBuffer(const InfoLogLevel log_level,
LogBuffer : : ~ LogBuffer ( ) { delete rep_ ; }
LogBuffer : : ~ LogBuffer ( ) { delete rep_ ; }
void LogBuffer : : AddLogToBuffer ( const char * format , . . . ) {
void LogBuffer : : AddLogToBuffer ( const char * format , va_list ap ) {
if ( ! info_log_ | | log_level_ < info_log_ - > GetInfoLogLevel ( ) ) {
if ( ! info_log_ | | log_level_ < info_log_ - > GetInfoLogLevel ( ) ) {
// Skip the level because of its level.
// Skip the level because of its level.
return ;
return ;
@ -69,10 +69,10 @@ void LogBuffer::AddLogToBuffer(const char* format, ...) {
// Print the message
// Print the message
if ( p < limit ) {
if ( p < limit ) {
va_list ap ;
va_list backup_ ap;
va_start ( ap , format ) ;
va_copy ( backup_ap , ap ) ;
p + = vsnprintf ( p , limit - p , format , ap ) ;
p + = vsnprintf ( p , limit - p , format , backup_ ap) ;
va_end ( ap ) ;
va_end ( backup_ ap) ;
}
}
// Add '\0' to the end
// Add '\0' to the end
@ -102,7 +102,7 @@ void LogToBuffer(LogBuffer* log_buffer, const char* format, ...) {
if ( log_buffer ! = nullptr ) {
if ( log_buffer ! = nullptr ) {
va_list ap ;
va_list ap ;
va_start ( ap , format ) ;
va_start ( ap , format ) ;
log_buffer - > AddLogToBuffer ( format ) ;
log_buffer - > AddLogToBuffer ( format , ap ) ;
va_end ( ap ) ;
va_end ( ap ) ;
}
}
}
}