Skip to content

Commit

Permalink
Fixing double logging in wdt/stargate
Browse files Browse the repository at this point in the history
Summary: Fixing double logging in wdt/stargate

Reviewed By: nedelchev

Differential Revision: D4500770

fbshipit-source-id: c5270be18f13d8ebc23f63234d25d6ccafc2a4e0
  • Loading branch information
uddipta authored and facebook-github-bot committed Feb 2, 2017
1 parent 6ecde8b commit 6c071c9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 2 additions & 0 deletions ErrorCodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <folly/Conv.h>
#include <string.h>

DEFINE_int32(wdt_double_precision, 2, "Precision while printing double");

namespace facebook {
namespace wdt {
std::string errorCodeToStr(ErrorCode code) {
Expand Down
17 changes: 12 additions & 5 deletions ErrorCodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,27 @@
*/
#pragma once

#include <gflags/gflags.h>
#include <glog/logging.h>
#include <wdt/WdtConfig.h>
#include <iomanip>
#include <string>

#define WDT_DOUBLE_FORMATTING \
std::fixed << std::setprecision(FLAGS_wdt_double_precision)

DECLARE_int32(wdt_double_precision);

namespace facebook {
namespace wdt {

// Call regular google log but prefix with wdt for easier extraction later
#define WDT_LOG_PREFIX "wdt>\t"
#define WLOG(X) LOG(X) << WDT_LOG_PREFIX
#define WVLOG(X) VLOG(X) << WDT_LOG_PREFIX
#define WPLOG(X) PLOG(X) << WDT_LOG_PREFIX
#define WLOG_IF(X, Y) LOG_IF(X, Y) << WDT_LOG_PREFIX
#define WVLOG_IF(X, Y) VLOG_IF(X, Y) << WDT_LOG_PREFIX
#define WLOG(X) LOG(X) << WDT_LOG_PREFIX << WDT_DOUBLE_FORMATTING
#define WVLOG(X) VLOG(X) << WDT_LOG_PREFIX << WDT_DOUBLE_FORMATTING
#define WPLOG(X) PLOG(X) << WDT_LOG_PREFIX << WDT_DOUBLE_FORMATTING
#define WLOG_IF(X, Y) LOG_IF(X, Y) << WDT_LOG_PREFIX << WDT_DOUBLE_FORMATTING
#define WVLOG_IF(X, Y) VLOG_IF(X, Y) << WDT_LOG_PREFIX << WDT_DOUBLE_FORMATTING
#define WTLOG(X) WLOG(X) << *this << " "
#define WTVLOG(X) WVLOG(X) << *this << " "
#define WTPLOG(X) WPLOG(X) << *this << " "
Expand Down
4 changes: 2 additions & 2 deletions TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ cpp_unittest(
headers = AutoHeaders.RECURSIVE_GLOB, # https://fburl.com/424819295
srcs = [ 'test/test_encdeci64_func.cpp', ],
deps = [
":testcommon",
":wdtlib4tests",
],
compiler_flags = wdt_compiler_flags,
)
Expand All @@ -80,7 +80,7 @@ cpp_binary(
headers = AutoHeaders.RECURSIVE_GLOB, # https://fburl.com/424819295
srcs = [ 'test/test_encdeci64_perf.cpp', ],
deps = [
":testcommon",
":wdtlib4tests",
"@/folly:benchmark",
"@/common/encode:coding",
],
Expand Down

0 comments on commit 6c071c9

Please sign in to comment.