From 82ccfcf5cae798d21881e41a7123e9ca3016988a Mon Sep 17 00:00:00 2001 From: solenberg Date: Mon, 14 Dec 2015 08:22:11 -0800 Subject: [PATCH] Remove unused and rarely used LOG_ macros. BUG= Review URL: https://codereview.webrtc.org/1522053002 Cr-Commit-Position: refs/heads/master@{#11014} --- .../audio_coding/acm2/acm_resampler.cc | 12 +++----- .../agc/agc_manager_direct.cc | 13 +++++---- webrtc/system_wrappers/include/logging.h | 29 ------------------- .../source/logging_unittest.cc | 13 --------- 4 files changed, 11 insertions(+), 56 deletions(-) diff --git a/webrtc/modules/audio_coding/acm2/acm_resampler.cc b/webrtc/modules/audio_coding/acm2/acm_resampler.cc index e38cd94a97..5df87d2a19 100644 --- a/webrtc/modules/audio_coding/acm2/acm_resampler.cc +++ b/webrtc/modules/audio_coding/acm2/acm_resampler.cc @@ -44,20 +44,16 @@ int ACMResampler::Resample10Msec(const int16_t* in_audio, if (resampler_.InitializeIfNeeded(in_freq_hz, out_freq_hz, num_audio_channels) != 0) { - LOG_FERR3(LS_ERROR, InitializeIfNeeded, in_freq_hz, out_freq_hz, - num_audio_channels); + LOG(LS_ERROR) << "InitializeIfNeeded(" << in_freq_hz << ", " << out_freq_hz + << ", " << num_audio_channels << ") failed."; return -1; } out_length = resampler_.Resample(in_audio, in_length, out_audio, out_capacity_samples); if (out_length == -1) { - LOG_FERR4(LS_ERROR, - Resample, - in_audio, - in_length, - out_audio, - out_capacity_samples); + LOG(LS_ERROR) << "Resample(" << in_audio << ", " << in_length << ", " + << out_audio << ", " << out_capacity_samples << ") failed."; return -1; } diff --git a/webrtc/modules/audio_processing/agc/agc_manager_direct.cc b/webrtc/modules/audio_processing/agc/agc_manager_direct.cc index e4b753bc3d..e56984a1b1 100644 --- a/webrtc/modules/audio_processing/agc/agc_manager_direct.cc +++ b/webrtc/modules/audio_processing/agc/agc_manager_direct.cc @@ -168,19 +168,19 @@ int AgcManagerDirect::Initialize() { // example, what happens when we change devices. if (gctrl_->set_mode(GainControl::kFixedDigital) != 0) { - LOG_FERR1(LS_ERROR, set_mode, GainControl::kFixedDigital); + LOG(LS_ERROR) << "set_mode(GainControl::kFixedDigital) failed."; return -1; } if (gctrl_->set_target_level_dbfs(2) != 0) { - LOG_FERR1(LS_ERROR, set_target_level_dbfs, 2); + LOG(LS_ERROR) << "set_target_level_dbfs(2) failed."; return -1; } if (gctrl_->set_compression_gain_db(kDefaultCompressionGain) != 0) { - LOG_FERR1(LS_ERROR, set_compression_gain_db, kDefaultCompressionGain); + LOG(LS_ERROR) << "set_compression_gain_db(kDefaultCompressionGain) failed."; return -1; } if (gctrl_->enable_limiter(true) != 0) { - LOG_FERR1(LS_ERROR, enable_limiter, true); + LOG(LS_ERROR) << "enable_limiter(true) failed."; return -1; } return 0; @@ -244,7 +244,7 @@ void AgcManagerDirect::Process(const int16_t* audio, } if (agc_->Process(audio, length, sample_rate_hz) != 0) { - LOG_FERR0(LS_ERROR, Agc::Process); + LOG(LS_ERROR) << "Agc::Process failed"; assert(false); } @@ -434,7 +434,8 @@ void AgcManagerDirect::UpdateCompressor() { compression_ = new_compression; compression_accumulator_ = new_compression; if (gctrl_->set_compression_gain_db(compression_) != 0) { - LOG_FERR1(LS_ERROR, set_compression_gain_db, compression_); + LOG(LS_ERROR) << "set_compression_gain_db(" << compression_ + << ") failed."; } } } diff --git a/webrtc/system_wrappers/include/logging.h b/webrtc/system_wrappers/include/logging.h index 2b53f4f1d1..0089841d4e 100644 --- a/webrtc/system_wrappers/include/logging.h +++ b/webrtc/system_wrappers/include/logging.h @@ -36,18 +36,6 @@ // type (basically, it just doesn't prepend the namespace). // LOG_F(sev) Like LOG(), but includes the name of the current function. -// Additional helper macros added by WebRTC: -// LOG_API is a shortcut for API call logging. Pass in the input parameters of -// the method. For example: -// Foo(int bar, int baz) { -// LOG_API2(bar, baz); -// } -// -// LOG_FERR is a shortcut for logging a failed function call. For example: -// if (!Foo(bar)) { -// LOG_FERR1(LS_WARNING, Foo, bar); -// } - #ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_LOGGING_H_ #define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_LOGGING_H_ @@ -137,23 +125,6 @@ class LogMessageVoidify { #define LOG_F(sev) LOG(sev) << __FUNCTION__ << ": " #endif -#define LOG_API0() LOG_F(LS_VERBOSE) -#define LOG_API1(v1) LOG_API0() << #v1 << "=" << v1 -#define LOG_API2(v1, v2) LOG_API1(v1) \ - << ", " << #v2 << "=" << v2 -#define LOG_API3(v1, v2, v3) LOG_API2(v1, v2) \ - << ", " << #v3 << "=" << v3 - -#define LOG_FERR0(sev, func) LOG(sev) << #func << " failed" -#define LOG_FERR1(sev, func, v1) LOG_FERR0(sev, func) \ - << ": " << #v1 << "=" << v1 -#define LOG_FERR2(sev, func, v1, v2) LOG_FERR1(sev, func, v1) \ - << ", " << #v2 << "=" << v2 -#define LOG_FERR3(sev, func, v1, v2, v3) LOG_FERR2(sev, func, v1, v2) \ - << ", " << #v3 << "=" << v3 -#define LOG_FERR4(sev, func, v1, v2, v3, v4) LOG_FERR3(sev, func, v1, v2, v3) \ - << ", " << #v4 << "=" << v4 - #endif // LOG } // namespace webrtc diff --git a/webrtc/system_wrappers/source/logging_unittest.cc b/webrtc/system_wrappers/source/logging_unittest.cc index 633d84b76b..2da24b26f4 100644 --- a/webrtc/system_wrappers/source/logging_unittest.cc +++ b/webrtc/system_wrappers/source/logging_unittest.cc @@ -72,18 +72,5 @@ TEST_F(LoggingTest, LogStream) { } } -TEST_F(LoggingTest, LogFunctionError) { - { - CriticalSectionScoped cs(crit_.get()); - int bar = 42; - int baz = 99; - level_ = kTraceError; - expected_log_ << "(logging_unittest.cc:" << __LINE__ + 2 - << "): Foo failed: bar=" << bar << ", baz=" << baz; - LOG_FERR2(LS_ERROR, Foo, bar, baz); - cv_->SleepCS(*crit_.get(), 2000); - } -} - } // namespace } // namespace webrtc