diff options
Diffstat (limited to 'base')
-rw-r--r-- | base/logging.h | 21 | ||||
-rw-r--r-- | base/process_util_mac.mm | 4 |
2 files changed, 23 insertions, 2 deletions
diff --git a/base/logging.h b/base/logging.h index b1bc0b0..baf8eb6 100644 --- a/base/logging.h +++ b/base/logging.h @@ -382,6 +382,23 @@ const LogSeverity LOG_0 = LOG_ERROR; LAZY_STREAM(VLOG_STREAM(verbose_level), \ VLOG_IS_ON(verbose_level) && (condition)) +#if defined (OS_WIN) +#define VPLOG_STREAM(verbose_level) \ + logging::Win32ErrorLogMessage(__FILE__, __LINE__, -verbose_level, \ + ::logging::GetLastSystemErrorCode()).stream() +#elif defined(OS_POSIX) +#define VPLOG_STREAM(verbose_level) \ + logging::ErrnoLogMessage(__FILE__, __LINE__, -verbose_level, \ + ::logging::GetLastSystemErrorCode()).stream() +#endif + +#define VPLOG(verbose_level) \ + LAZY_STREAM(VPLOG_STREAM(verbose_level), VLOG_IS_ON(verbose_level)) + +#define VPLOG_IF(verbose_level, condition) \ + LAZY_STREAM(VPLOG_STREAM(verbose_level), \ + VLOG_IS_ON(verbose_level) && (condition)) + // TODO(akalin): Add more VLOG variants, e.g. VPLOG. #define LOG_ASSERT(condition) \ @@ -539,6 +556,7 @@ DEFINE_CHECK_OP_IMPL(GT, > ) #define DLOG_ASSERT(condition) LOG_ASSERT(condition) #define DPLOG_IF(severity, condition) PLOG_IF(severity, condition) #define DVLOG_IF(verboselevel, condition) VLOG_IF(verboselevel, condition) +#define DVPLOG_IF(verboselevel, condition) VPLOG_IF(verboselevel, condition) #else // ENABLE_DLOG @@ -555,6 +573,7 @@ DEFINE_CHECK_OP_IMPL(GT, > ) #define DLOG_ASSERT(condition) DLOG_EAT_STREAM_PARAMETERS #define DPLOG_IF(severity, condition) DLOG_EAT_STREAM_PARAMETERS #define DVLOG_IF(verboselevel, condition) DLOG_EAT_STREAM_PARAMETERS +#define DVPLOG_IF(verboselevel, condition) DLOG_EAT_STREAM_PARAMETERS #endif // ENABLE_DLOG @@ -589,6 +608,8 @@ enum { DEBUG_MODE = ENABLE_DLOG }; #define DVLOG(verboselevel) DLOG_IF(INFO, VLOG_IS_ON(verboselevel)) +#define DVPLOG(verboselevel) DVPLOG_IF(verboselevel, VLOG_IS_ON(verboselevel)) + // Definitions for DCHECK et al. #if ENABLE_DCHECK diff --git a/base/process_util_mac.mm b/base/process_util_mac.mm index 6d05581..39eabac 100644 --- a/base/process_util_mac.mm +++ b/base/process_util_mac.mm @@ -124,13 +124,13 @@ bool ProcessIterator::CheckForNextProcess() { // Find out what size buffer we need. size_t data_len = 0; if (sysctl(mib, arraysize(mib), NULL, &data_len, NULL, 0) < 0) { - LOG(ERROR) << "failed to figure out the buffer size for a commandline"; + DVPLOG(1) << "failed to figure out the buffer size for a commandline"; continue; } data.resize(data_len); if (sysctl(mib, arraysize(mib), &data[0], &data_len, NULL, 0) < 0) { - LOG(ERROR) << "failed to fetch a commandline"; + DVPLOG(1) << "failed to fetch a commandline"; continue; } |