Skip to content

Commit 0a26a09

Browse files
hzellercopybara-github
authored andcommitted
Remove exporting of FLAGS_v and FLAGS_vmodule in vlog_is_on.h
This leaves it to just provide XLS_VLOG_IS_ON() which will be removed in the next step and replaced with VLOG_IS_ON(). PiperOrigin-RevId: 615942629
1 parent 44d18d9 commit 0a26a09

File tree

6 files changed

+14
-105
lines changed

6 files changed

+14
-105
lines changed

xls/common/logging/BUILD

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,7 @@ cc_library(
9898
name = "vlog_is_on",
9999
hdrs = ["vlog_is_on.h"],
100100
visibility = ["//xls:xls_internal"],
101-
deps = [
102-
"@com_google_absl//absl/flags:flag",
103-
"@com_google_absl//absl/log",
104-
],
105-
)
106-
107-
cc_test(
108-
name = "vlog_is_on_test",
109-
srcs = ["vlog_is_on_test.cc"],
110-
deps = [
111-
":logging",
112-
":vlog_is_on",
113-
"@com_google_absl//absl/flags:flag",
114-
"@com_google_absl//absl/log:globals",
115-
"//xls/common:xls_gunit",
116-
"//xls/common:xls_gunit_main",
117-
],
101+
deps = ["@com_google_absl//absl/log"],
118102
)
119103

120104
py_test(

xls/common/logging/vlog_is_on.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,8 @@
4141
#ifndef XLS_COMMON_LOGGING_VLOG_IS_ON_H_
4242
#define XLS_COMMON_LOGGING_VLOG_IS_ON_H_
4343

44-
#include <cstdint>
45-
#include <string>
46-
47-
#include "absl/flags/declare.h"
4844
#include "absl/log/log.h"
4945

50-
ABSL_DECLARE_FLAG(int32_t, v);
51-
// Note: Setting vmodule with absl::SetFlag is not supported. Instead use
52-
// absl::SetVLogLevel.
53-
ABSL_DECLARE_FLAG(std::string, vmodule);
54-
5546
// We pack an int16_t verbosity level and an int16_t epoch into an
5647
// int32_t at every XLS_VLOG_IS_ON() call site. The level determines
5748
// whether the site should log, and the epoch determines whether the

xls/common/logging/vlog_is_on_test.cc

Lines changed: 0 additions & 72 deletions
This file was deleted.

xls/common/status/status_builder_test.cc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "gmock/gmock.h"
2020
#include "gtest/gtest.h"
2121
#include "absl/base/log_severity.h"
22-
#include "absl/flags/flag.h"
2322
#include "absl/log/globals.h"
2423
#include "absl/log/log.h"
2524
#include "absl/log/log_entry.h"
@@ -224,10 +223,10 @@ TEST(StatusBuilderTest, LogToMultipleErrorLevelsLvalue) {
224223
ConvertToStatusAndIgnore(builder.Log(LogSeverity::kError) << "yes!");
225224

226225
// This one shouldn't log because vlogging is disabled.
227-
absl::SetFlag(&FLAGS_v, 0);
226+
absl::SetGlobalVLogLevel(0);
228227
ConvertToStatusAndIgnore(builder.VLog(2) << "Non!");
229228

230-
absl::SetFlag(&FLAGS_v, 2);
229+
absl::SetGlobalVLogLevel(2);
231230
ConvertToStatusAndIgnore(builder.VLog(2) << "Oui!");
232231
}
233232
}
@@ -245,10 +244,10 @@ TEST(StatusBuilderTest, LogToMultipleErrorLevelsRvalue) {
245244
.Log(LogSeverity::kError)
246245
<< "yes!");
247246
// This one shouldn't log because vlogging is disabled.
248-
absl::SetFlag(&FLAGS_v, 0);
247+
absl::SetGlobalVLogLevel(0);
249248
ConvertToStatusAndIgnore(
250249
StatusBuilder(absl::AbortedError(""), Locs::kSecret).VLog(2) << "Non!");
251-
absl::SetFlag(&FLAGS_v, 2);
250+
absl::SetGlobalVLogLevel(2);
252251
ConvertToStatusAndIgnore(
253252
StatusBuilder(absl::AbortedError(""), Locs::kSecret).VLog(2) << "Oui!");
254253
}
@@ -372,7 +371,7 @@ TEST(StatusBuilderTest, LogEveryZeroDuration) {
372371
}
373372

374373
TEST(StatusBuilderTest, VLogModuleLvalue) {
375-
absl::SetFlag(&FLAGS_v, 0);
374+
absl::SetGlobalVLogLevel(0);
376375
absl::SetVLogLevel("level0", 0);
377376
absl::SetVLogLevel("level1", 1);
378377
absl::SetVLogLevel("level2", 2);
@@ -417,7 +416,7 @@ TEST(StatusBuilderTest, VLogModuleLvalue) {
417416
}
418417

419418
TEST(StatusBuilderTest, VLogModuleRvalue) {
420-
absl::SetFlag(&FLAGS_v, 0);
419+
absl::SetGlobalVLogLevel(0);
421420
absl::SetVLogLevel("level0", 0);
422421
absl::SetVLogLevel("level1", 1);
423422
absl::SetVLogLevel("level2", 2);

xls/fuzzer/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ cc_library(
316316
"//xls/tools:eval_utils",
317317
"@com_google_absl//absl/algorithm:container",
318318
"@com_google_absl//absl/container:flat_hash_map",
319+
"@com_google_absl//absl/flags:flag",
319320
"@com_google_absl//absl/log",
320321
"@com_google_absl//absl/log:check",
321322
"@com_google_absl//absl/status",

xls/fuzzer/sample_runner.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
#include "absl/algorithm/container.h"
3232
#include "absl/container/flat_hash_map.h"
33+
#include "absl/flags/declare.h"
34+
#include "absl/flags/flag.h"
3335
#include "absl/log/check.h"
3436
#include "absl/log/log.h"
3537
#include "absl/status/status.h"
@@ -76,6 +78,10 @@
7678
#include "xls/tools/eval_utils.h"
7779
#include "re2/re2.h"
7880

81+
// These are used to forward, but also see comment below.
82+
ABSL_DECLARE_FLAG(int32_t, v);
83+
ABSL_DECLARE_FLAG(std::string, vmodule);
84+
7985
namespace xls {
8086

8187
namespace {

0 commit comments

Comments
 (0)