Merge pull request #790 from git-hulk/feature/logs-to-stdout
Add the logtostdout and colorlogtostdout flag to allow logging to stdout
This commit is contained in:
commit
a8e0007e96
@ -428,6 +428,12 @@ typedef void(*CustomPrefixCallback)(std::ostream& s, const LogMessageInfo& l, vo
|
|||||||
// Set whether appending a timestamp to the log file name
|
// Set whether appending a timestamp to the log file name
|
||||||
DECLARE_bool(timestamp_in_logfile_name);
|
DECLARE_bool(timestamp_in_logfile_name);
|
||||||
|
|
||||||
|
// Set whether log messages go to stdout instead of logfiles
|
||||||
|
DECLARE_bool(logtostdout);
|
||||||
|
|
||||||
|
// Set color messages logged to stdout (if supported by terminal).
|
||||||
|
DECLARE_bool(colorlogtostdout);
|
||||||
|
|
||||||
// Set whether log messages go to stderr instead of logfiles
|
// Set whether log messages go to stderr instead of logfiles
|
||||||
DECLARE_bool(logtostderr);
|
DECLARE_bool(logtostderr);
|
||||||
|
|
||||||
|
|||||||
@ -353,6 +353,9 @@ static inline void CaptureTestOutput(int fd, const string & filename) {
|
|||||||
CHECK(s_captured_streams[fd] == NULL);
|
CHECK(s_captured_streams[fd] == NULL);
|
||||||
s_captured_streams[fd] = new CapturedStream(fd, filename);
|
s_captured_streams[fd] = new CapturedStream(fd, filename);
|
||||||
}
|
}
|
||||||
|
static inline void CaptureTestStdout() {
|
||||||
|
CaptureTestOutput(STDOUT_FILENO, FLAGS_test_tmpdir + "/captured.out");
|
||||||
|
}
|
||||||
static inline void CaptureTestStderr() {
|
static inline void CaptureTestStderr() {
|
||||||
CaptureTestOutput(STDERR_FILENO, FLAGS_test_tmpdir + "/captured.err");
|
CaptureTestOutput(STDERR_FILENO, FLAGS_test_tmpdir + "/captured.err");
|
||||||
}
|
}
|
||||||
@ -507,9 +510,13 @@ static inline void WriteToFile(const string& body, const string& file) {
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool MungeAndDiffTestStderr(const string& golden_filename) {
|
static inline bool MungeAndDiffTest(const string& golden_filename,
|
||||||
CapturedStream* cap = s_captured_streams[STDERR_FILENO];
|
CapturedStream* cap) {
|
||||||
CHECK(cap) << ": did you forget CaptureTestStderr()?";
|
if (cap == s_captured_streams[STDOUT_FILENO]) {
|
||||||
|
CHECK(cap) << ": did you forget CaptureTestStdout()?";
|
||||||
|
} else {
|
||||||
|
CHECK(cap) << ": did you forget CaptureTestStderr()?";
|
||||||
|
}
|
||||||
|
|
||||||
cap->StopCapture();
|
cap->StopCapture();
|
||||||
|
|
||||||
@ -539,6 +546,14 @@ static inline bool MungeAndDiffTestStderr(const string& golden_filename) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool MungeAndDiffTestStderr(const string& golden_filename) {
|
||||||
|
return MungeAndDiffTest(golden_filename, s_captured_streams[STDERR_FILENO]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool MungeAndDiffTestStdout(const string& golden_filename) {
|
||||||
|
return MungeAndDiffTest(golden_filename, s_captured_streams[STDOUT_FILENO]);
|
||||||
|
}
|
||||||
|
|
||||||
// Save flags used from logging_unittest.cc.
|
// Save flags used from logging_unittest.cc.
|
||||||
#ifndef HAVE_LIB_GFLAGS
|
#ifndef HAVE_LIB_GFLAGS
|
||||||
struct FlagSaver {
|
struct FlagSaver {
|
||||||
|
|||||||
@ -122,6 +122,10 @@ GLOG_DEFINE_bool(alsologtostderr, BoolFromEnv("GOOGLE_ALSOLOGTOSTDERR", false),
|
|||||||
"log messages go to stderr in addition to logfiles");
|
"log messages go to stderr in addition to logfiles");
|
||||||
GLOG_DEFINE_bool(colorlogtostderr, false,
|
GLOG_DEFINE_bool(colorlogtostderr, false,
|
||||||
"color messages logged to stderr (if supported by terminal)");
|
"color messages logged to stderr (if supported by terminal)");
|
||||||
|
GLOG_DEFINE_bool(colorlogtostdout, false,
|
||||||
|
"color messages logged to stdout (if supported by terminal)");
|
||||||
|
GLOG_DEFINE_bool(logtostdout, BoolFromEnv("GOOGLE_LOGTOSTDOUT", false),
|
||||||
|
"log messages go to stdout instead of logfiles");
|
||||||
#ifdef GLOG_OS_LINUX
|
#ifdef GLOG_OS_LINUX
|
||||||
GLOG_DEFINE_bool(drop_log_memory, true, "Drop in-memory buffers of log contents. "
|
GLOG_DEFINE_bool(drop_log_memory, true, "Drop in-memory buffers of log contents. "
|
||||||
"Logs can grow very quickly and they are rarely read before they "
|
"Logs can grow very quickly and they are rarely read before they "
|
||||||
@ -739,43 +743,63 @@ inline void LogDestination::SetEmailLogging(LogSeverity min_severity,
|
|||||||
LogDestination::addresses_ = addresses;
|
LogDestination::addresses_ = addresses;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ColoredWriteToStderr(LogSeverity severity,
|
static void ColoredWriteToStderrOrStdout(FILE* output, LogSeverity severity,
|
||||||
const char* message, size_t len) {
|
const char* message, size_t len) {
|
||||||
const GLogColor color =
|
bool is_stdout = (output == stdout);
|
||||||
(LogDestination::terminal_supports_color() && FLAGS_colorlogtostderr) ?
|
const GLogColor color = (LogDestination::terminal_supports_color() &&
|
||||||
SeverityToColor(severity) : COLOR_DEFAULT;
|
((!is_stdout && FLAGS_colorlogtostderr) ||
|
||||||
|
(is_stdout && FLAGS_colorlogtostdout)))
|
||||||
|
? SeverityToColor(severity)
|
||||||
|
: COLOR_DEFAULT;
|
||||||
|
|
||||||
// Avoid using cerr from this module since we may get called during
|
// Avoid using cerr from this module since we may get called during
|
||||||
// exit code, and cerr may be partially or fully destroyed by then.
|
// exit code, and cerr may be partially or fully destroyed by then.
|
||||||
if (COLOR_DEFAULT == color) {
|
if (COLOR_DEFAULT == color) {
|
||||||
fwrite(message, len, 1, stderr);
|
fwrite(message, len, 1, output);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef GLOG_OS_WINDOWS
|
#ifdef GLOG_OS_WINDOWS
|
||||||
const HANDLE stderr_handle = GetStdHandle(STD_ERROR_HANDLE);
|
const HANDLE output_handle =
|
||||||
|
GetStdHandle(is_stdout ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE);
|
||||||
|
|
||||||
// Gets the current text color.
|
// Gets the current text color.
|
||||||
CONSOLE_SCREEN_BUFFER_INFO buffer_info;
|
CONSOLE_SCREEN_BUFFER_INFO buffer_info;
|
||||||
GetConsoleScreenBufferInfo(stderr_handle, &buffer_info);
|
GetConsoleScreenBufferInfo(output_handle, &buffer_info);
|
||||||
const WORD old_color_attrs = buffer_info.wAttributes;
|
const WORD old_color_attrs = buffer_info.wAttributes;
|
||||||
|
|
||||||
// We need to flush the stream buffers into the console before each
|
// We need to flush the stream buffers into the console before each
|
||||||
// SetConsoleTextAttribute call lest it affect the text that is already
|
// SetConsoleTextAttribute call lest it affect the text that is already
|
||||||
// printed but has not yet reached the console.
|
// printed but has not yet reached the console.
|
||||||
fflush(stderr);
|
fflush(output);
|
||||||
SetConsoleTextAttribute(stderr_handle,
|
SetConsoleTextAttribute(output_handle,
|
||||||
GetColorAttribute(color) | FOREGROUND_INTENSITY);
|
GetColorAttribute(color) | FOREGROUND_INTENSITY);
|
||||||
fwrite(message, len, 1, stderr);
|
fwrite(message, len, 1, output);
|
||||||
fflush(stderr);
|
fflush(output);
|
||||||
// Restores the text color.
|
// Restores the text color.
|
||||||
SetConsoleTextAttribute(stderr_handle, old_color_attrs);
|
SetConsoleTextAttribute(output_handle, old_color_attrs);
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "\033[0;3%sm", GetAnsiColorCode(color));
|
fprintf(output, "\033[0;3%sm", GetAnsiColorCode(color));
|
||||||
fwrite(message, len, 1, stderr);
|
fwrite(message, len, 1, output);
|
||||||
fprintf(stderr, "\033[m"); // Resets the terminal to default.
|
fprintf(output, "\033[m"); // Resets the terminal to default.
|
||||||
#endif // GLOG_OS_WINDOWS
|
#endif // GLOG_OS_WINDOWS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ColoredWriteToStdout(LogSeverity severity, const char* message,
|
||||||
|
size_t len) {
|
||||||
|
FILE* output = stdout;
|
||||||
|
// We also need to send logs to the stderr when the severity is
|
||||||
|
// higher or equal to the stderr threshold.
|
||||||
|
if (severity >= FLAGS_stderrthreshold) {
|
||||||
|
output = stderr;
|
||||||
|
}
|
||||||
|
ColoredWriteToStderrOrStdout(output, severity, message, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ColoredWriteToStderr(LogSeverity severity, const char* message,
|
||||||
|
size_t len) {
|
||||||
|
ColoredWriteToStderrOrStdout(stderr, severity, message, len);
|
||||||
|
}
|
||||||
|
|
||||||
static void WriteToStderr(const char* message, size_t len) {
|
static void WriteToStderr(const char* message, size_t len) {
|
||||||
// Avoid using cerr from this module since we may get called during
|
// Avoid using cerr from this module since we may get called during
|
||||||
// exit code, and cerr may be partially or fully destroyed by then.
|
// exit code, and cerr may be partially or fully destroyed by then.
|
||||||
@ -847,8 +871,9 @@ inline void LogDestination::LogToAllLogfiles(LogSeverity severity,
|
|||||||
time_t timestamp,
|
time_t timestamp,
|
||||||
const char* message,
|
const char* message,
|
||||||
size_t len) {
|
size_t len) {
|
||||||
|
if (FLAGS_logtostdout) { // global flag: never log to file
|
||||||
if ( FLAGS_logtostderr ) { // global flag: never log to file
|
ColoredWriteToStdout(severity, message, len);
|
||||||
|
} else if (FLAGS_logtostderr) { // global flag: never log to file
|
||||||
ColoredWriteToStderr(severity, message, len);
|
ColoredWriteToStderr(severity, message, len);
|
||||||
} else {
|
} else {
|
||||||
for (int i = severity; i >= 0; --i) {
|
for (int i = severity; i >= 0; --i) {
|
||||||
@ -1812,9 +1837,14 @@ void LogMessage::SendToLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
|
|||||||
// global flag: never log to file if set. Also -- don't log to a
|
// global flag: never log to file if set. Also -- don't log to a
|
||||||
// file if we haven't parsed the command line flags to get the
|
// file if we haven't parsed the command line flags to get the
|
||||||
// program name.
|
// program name.
|
||||||
if (FLAGS_logtostderr || !IsGoogleLoggingInitialized()) {
|
if (FLAGS_logtostderr || FLAGS_logtostdout || !IsGoogleLoggingInitialized()) {
|
||||||
ColoredWriteToStderr(data_->severity_,
|
if (FLAGS_logtostdout) {
|
||||||
data_->message_text_, data_->num_chars_to_log_);
|
ColoredWriteToStdout(data_->severity_, data_->message_text_,
|
||||||
|
data_->num_chars_to_log_);
|
||||||
|
} else {
|
||||||
|
ColoredWriteToStderr(data_->severity_, data_->message_text_,
|
||||||
|
data_->num_chars_to_log_);
|
||||||
|
}
|
||||||
|
|
||||||
// this could be protected by a flag if necessary.
|
// this could be protected by a flag if necessary.
|
||||||
LogDestination::LogToSinks(data_->severity_,
|
LogDestination::LogToSinks(data_->severity_,
|
||||||
@ -1824,7 +1854,6 @@ void LogMessage::SendToLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
|
|||||||
(data_->num_chars_to_log_ -
|
(data_->num_chars_to_log_ -
|
||||||
data_->num_prefix_chars_ - 1) );
|
data_->num_prefix_chars_ - 1) );
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// log this message to all log files of severity <= severity_
|
// log this message to all log files of severity <= severity_
|
||||||
LogDestination::LogToAllLogfiles(data_->severity_, logmsgtime_.timestamp(),
|
LogDestination::LogToAllLogfiles(data_->severity_, logmsgtime_.timestamp(),
|
||||||
data_->message_text_,
|
data_->message_text_,
|
||||||
@ -1862,7 +1891,7 @@ void LogMessage::SendToLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
|
|||||||
fatal_time = logmsgtime_.timestamp();
|
fatal_time = logmsgtime_.timestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FLAGS_logtostderr) {
|
if (!FLAGS_logtostderr && !FLAGS_logtostdout) {
|
||||||
for (int i = 0; i < NUM_SEVERITIES; ++i) {
|
for (int i = 0; i < NUM_SEVERITIES; ++i) {
|
||||||
if (LogDestination::log_destinations_[i]) {
|
if (LogDestination::log_destinations_[i]) {
|
||||||
LogDestination::log_destinations_[i]->logger_->Write(true, 0, "", 0);
|
LogDestination::log_destinations_[i]->logger_->Write(true, 0, "", 0);
|
||||||
|
|||||||
@ -242,6 +242,22 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
FLAGS_logtostderr = false;
|
FLAGS_logtostderr = false;
|
||||||
|
|
||||||
|
FLAGS_logtostdout = true;
|
||||||
|
FLAGS_stderrthreshold = NUM_SEVERITIES;
|
||||||
|
CaptureTestStdout();
|
||||||
|
TestRawLogging();
|
||||||
|
TestLoggingLevels();
|
||||||
|
TestLogString();
|
||||||
|
TestLogSink();
|
||||||
|
TestLogToString();
|
||||||
|
TestLogSinkWaitTillSent();
|
||||||
|
TestCHECK();
|
||||||
|
TestDCHECK();
|
||||||
|
TestSTREQ();
|
||||||
|
EXPECT_TRUE(
|
||||||
|
MungeAndDiffTestStdout(FLAGS_test_srcdir + "/src/logging_unittest.out"));
|
||||||
|
FLAGS_logtostdout = false;
|
||||||
|
|
||||||
TestBasename();
|
TestBasename();
|
||||||
TestBasenameAppendWhenNoTimestamp();
|
TestBasenameAppendWhenNoTimestamp();
|
||||||
TestTwoProcessesWrite();
|
TestTwoProcessesWrite();
|
||||||
@ -1263,6 +1279,9 @@ class TestWaitingLogSink : public LogSink {
|
|||||||
// Check that LogSink::WaitTillSent can be used in the advertised way.
|
// Check that LogSink::WaitTillSent can be used in the advertised way.
|
||||||
// We also do golden-stderr comparison.
|
// We also do golden-stderr comparison.
|
||||||
static void TestLogSinkWaitTillSent() {
|
static void TestLogSinkWaitTillSent() {
|
||||||
|
// Clear global_messages here to make sure that this test case can be
|
||||||
|
// reentered
|
||||||
|
global_messages.clear();
|
||||||
{ TestWaitingLogSink sink;
|
{ TestWaitingLogSink sink;
|
||||||
// Sleeps give the sink threads time to do all their work,
|
// Sleeps give the sink threads time to do all their work,
|
||||||
// so that we get a reliable log capture to compare to the golden file.
|
// so that we get a reliable log capture to compare to the golden file.
|
||||||
|
|||||||
150
src/logging_unittest.out
Normal file
150
src/logging_unittest.out
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
|
||||||
|
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
|
||||||
|
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
|
||||||
|
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
|
||||||
|
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
|
||||||
|
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
|
||||||
|
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
|
||||||
|
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
|
||||||
|
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
|
||||||
|
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
|
||||||
|
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_STRING: reported info
|
||||||
|
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_STRING: reported warning
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_STRING: reported error
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_STRING: LOG_STRING: collected info
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_STRING: LOG_STRING: collected warning
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_STRING: LOG_STRING: collected error
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected info
|
||||||
|
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected warning
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected error
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: reported info
|
||||||
|
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: reported warning
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: reported error
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_SINK:
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected info
|
||||||
|
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected warning
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected error
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK_BUT_NOT_TO_LOGFILE: collected info
|
||||||
|
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK_BUT_NOT_TO_LOGFILE: collected warning
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK_BUT_NOT_TO_LOGFILE: collected error
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: collected info
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_STRING: LOG_TO_STRING: collected info
|
||||||
|
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: collected warning
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_STRING: LOG_TO_STRING: collected warning
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: collected error
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_STRING: LOG_TO_STRING: collected error
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: reported info
|
||||||
|
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: reported warning
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: reported error
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink is sending out a message: IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Have 0 left
|
||||||
|
EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 2
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink is sending out a message: EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 2
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Have 0 left
|
||||||
|
WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 3
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink is sending out a message: WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 3
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Have 0 left
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink capture: IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 1
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink capture: EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 2
|
||||||
|
IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink capture: WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 3
|
||||||
@ -123,8 +123,9 @@ static char crash_buf[kLogBufSize + 1] = { 0 }; // Will end in '\0'
|
|||||||
GLOG_ATTRIBUTE_FORMAT(printf, 4, 5)
|
GLOG_ATTRIBUTE_FORMAT(printf, 4, 5)
|
||||||
void RawLog__(LogSeverity severity, const char* file, int line,
|
void RawLog__(LogSeverity severity, const char* file, int line,
|
||||||
const char* format, ...) {
|
const char* format, ...) {
|
||||||
if (!(FLAGS_logtostderr || severity >= FLAGS_stderrthreshold ||
|
if (!(FLAGS_logtostdout || FLAGS_logtostderr ||
|
||||||
FLAGS_alsologtostderr || !IsGoogleLoggingInitialized())) {
|
severity >= FLAGS_stderrthreshold || FLAGS_alsologtostderr ||
|
||||||
|
!IsGoogleLoggingInitialized())) {
|
||||||
return; // this stderr log message is suppressed
|
return; // this stderr log message is suppressed
|
||||||
}
|
}
|
||||||
// can't call localtime_r here: it can allocate
|
// can't call localtime_r here: it can allocate
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user