Skip to content

Commit 9187047

Browse files
authored
Nitpick use Cerr only in debug build (#15399)
1 parent 508e93d commit 9187047

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

ydb/core/tablet_flat/flat_stat_table.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,23 @@ class TKeyAccessSample {
205205

206206
using TBuildStatsYieldHandler = std::function<void()>;
207207

208+
#ifndef NDEBUG
208209
#define LOG_BUILD_STATS(stream) \
209-
if (auto actorContext = NActors::TlsActivationContext; actorContext) { \
210-
LOG_TRACE_S(*actorContext, NKikimrServices::TABLET_STATS_BUILDER, logPrefix << stream); \
211-
} else { \
212-
Cerr << logPrefix << stream << Endl; \
213-
}
210+
do { \
211+
if (auto actorContext = NActors::TlsActivationContext; actorContext) { \
212+
LOG_TRACE_S(*actorContext, NKikimrServices::TABLET_STATS_BUILDER, logPrefix << stream); \
213+
} else { \
214+
Cerr << logPrefix << stream << Endl; \
215+
} \
216+
} while (0)
217+
#else
218+
#define LOG_BUILD_STATS(stream) \
219+
do { \
220+
if (auto actorContext = NActors::TlsActivationContext; actorContext) { \
221+
LOG_TRACE_S(*actorContext, NKikimrServices::TABLET_STATS_BUILDER, logPrefix << stream); \
222+
} \
223+
} while (0)
224+
#endif
214225

215226
bool BuildStats(const TSubset& subset, TStats& stats, ui64 rowCountResolution, ui64 dataSizeResolution, ui32 histogramBucketsCount, IPages* env,
216227
TBuildStatsYieldHandler yieldHandler, const TString& logPrefix = {});

0 commit comments

Comments
 (0)