Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Commit 1b59cb0

Browse files
authored
drop custom prefix option (#898)
1 parent af8344b commit 1b59cb0

File tree

11 files changed

+50
-1761
lines changed

11 files changed

+50
-1761
lines changed

.github/workflows/emscripten.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ jobs:
77
defaults:
88
run:
99
shell: bash
10-
name: Emscripten-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.extra}}
10+
name: Emscripten-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}
1111
runs-on: ubuntu-latest
1212
container: emscripten/emsdk
1313
strategy:
1414
fail-fast: true
1515
matrix:
1616
build_type: [Release, Debug]
17-
extra: [no-custom-prefix, custom-prefix]
1817
lib: [static]
1918
std: [98, 11, 14, 17, 20]
2019

@@ -49,7 +48,6 @@ jobs:
4948
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
5049
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \
5150
-DCMAKE_RANLIB=$(which emranlib) \
52-
-DWITH_CUSTOM_PREFIX=${{matrix.extra == 'custom-prefix'}} \
5351
-G Ninja \
5452
-Werror
5553

.github/workflows/linux.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ jobs:
77
defaults:
88
run:
99
shell: bash
10-
name: GCC-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.extra}}
10+
name: GCC-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}
1111
runs-on: ubuntu-22.04
1212
strategy:
1313
fail-fast: true
1414
matrix:
1515
build_type: [Release, Debug]
16-
extra: [no-custom-prefix, custom-prefix]
1716
lib: [shared, static]
1817
std: [98, 11, 14, 17, 20]
1918

@@ -74,7 +73,6 @@ jobs:
7473
-DCMAKE_CXX_STANDARD=${{matrix.std}} \
7574
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
7675
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \
77-
-DWITH_CUSTOM_PREFIX=${{matrix.extra == 'custom-prefix'}} \
7876
-G Ninja \
7977
-Werror
8078

.github/workflows/windows.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [push, pull_request]
44

55
jobs:
66
build-msvc:
7-
name: ${{matrix.msvc}}-${{matrix.arch}}-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.extra}}
7+
name: ${{matrix.msvc}}-${{matrix.arch}}-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}
88
runs-on: ${{matrix.os}}
99
defaults:
1010
run:
@@ -17,7 +17,6 @@ jobs:
1717
matrix:
1818
arch: [Win32, x64]
1919
build_type: [Debug, Release]
20-
extra: [no-custom-prefix, custom-prefix]
2120
lib: [shared, static]
2221
msvc: [VS-16-2019, VS-17-2022]
2322
# Visual Studio 17 2022 does not support C++11 and older language standard
@@ -106,7 +105,6 @@ jobs:
106105
-DCMAKE_EXE_LINKER_FLAGS_RELEASE='/INCREMENTAL:NO /DEBUG' `
107106
-DCMAKE_INSTALL_PREFIX:PATH=./install `
108107
-DCMAKE_MSVC_RUNTIME_LIBRARY='MultiThreaded$<$<CONFIG:Debug>:Debug>DLL' `
109-
-DWITH_CUSTOM_PREFIX=${{matrix.extra == 'custom-prefix'}} `
110108
-G "${{matrix.generator}}" `
111109
-Werror
112110
@@ -129,18 +127,17 @@ jobs:
129127
--target install
130128
131129
build-mingw:
132-
name: ${{matrix.sys}}-${{matrix.env}}-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.extra}}
130+
name: ${{matrix.sys}}-${{matrix.env}}-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}
133131
runs-on: windows-2022
134132
env:
135-
BUILDDIR: 'build_${{matrix.sys}}-${{matrix.env}}-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.extra}}'
133+
BUILDDIR: 'build_${{matrix.sys}}-${{matrix.env}}-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}'
136134
defaults:
137135
run:
138136
shell: msys2 {0}
139137
strategy:
140138
fail-fast: true
141139
matrix:
142140
build_type: [Debug]
143-
extra: [no-custom-prefix, custom-prefix]
144141
lib: [shared, static]
145142
std: [98, 11, 14, 17, 20]
146143
sys: [mingw32, mingw64]
@@ -183,7 +180,6 @@ jobs:
183180
-DCMAKE_CXX_STANDARD=${{matrix.std}} \
184181
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
185182
-DCMAKE_INSTALL_PREFIX:PATH=./install \
186-
-DWITH_CUSTOM_PREFIX=${{matrix.extra == 'custom-prefix'}} \
187183
-G Ninja \
188184
-Werror
189185

CMakeLists.txt

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ include (GNUInstallDirs)
3737
option (BUILD_SHARED_LIBS "Build shared libraries" ON)
3838
option (PRINT_UNSYMBOLIZED_STACK_TRACES
3939
"Print file offsets in traces instead of symbolizing" OFF)
40-
option (WITH_CUSTOM_PREFIX "Enable support for user-generated message prefixes" ON)
4140
option (WITH_GFLAGS "Use gflags" ON)
4241
option (WITH_GTEST "Use Google Test" ON)
4342
option (WITH_PKGCONFIG "Enable pkg-config support" ON)
@@ -694,10 +693,6 @@ if (CYGWIN OR WIN32)
694693
target_compile_definitions (glog PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES)
695694
endif (CYGWIN OR WIN32)
696695

697-
if (WITH_CUSTOM_PREFIX)
698-
target_compile_definitions (glog PUBLIC GLOG_CUSTOM_PREFIX_SUPPORT)
699-
endif (WITH_CUSTOM_PREFIX)
700-
701696
set_target_properties (glog PROPERTIES PUBLIC_HEADER "${GLOG_PUBLIC_H}")
702697

703698
target_include_directories (glog BEFORE PUBLIC
@@ -781,27 +776,6 @@ if (BUILD_TESTING)
781776

782777
target_link_libraries (logging_unittest PRIVATE ${_GLOG_TEST_LIBS})
783778

784-
if (WITH_CUSTOM_PREFIX)
785-
add_executable (logging_custom_prefix_unittest
786-
src/logging_custom_prefix_unittest.cc
787-
)
788-
789-
target_link_libraries (logging_custom_prefix_unittest PRIVATE ${_GLOG_TEST_LIBS})
790-
791-
add_test (NAME logging_custom_prefix
792-
COMMAND logging_custom_prefix_unittest)
793-
794-
# FIXME: Skip flaky test
795-
set_tests_properties (logging_custom_prefix PROPERTIES SKIP_REGULAR_EXPRESSION
796-
"Check failed: time_ns within LogTimes::LOG_PERIOD_TOL_NS of LogTimes::LOG_PERIOD_NS")
797-
798-
if (APPLE)
799-
# FIXME: Skip flaky test
800-
set_property (TEST logging_custom_prefix APPEND PROPERTY SKIP_REGULAR_EXPRESSION
801-
"unexpected new.*PASS\nTest with golden file failed. We'll try to show the diff:")
802-
endif (APPLE)
803-
endif (WITH_CUSTOM_PREFIX)
804-
805779
add_executable (stl_logging_unittest
806780
src/stl_logging_unittest.cc
807781
)

README.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,7 @@ Custom Log Prefix Format
534534
~~~~~~~~~~~~~~~~~~~~~~~~
535535

536536
glog supports changing the format of the prefix attached to log messages by
537-
receiving a user-provided callback to be used to generate such strings. That
538-
feature must be enabled at compile time by the ``WITH_CUSTOM_PREFIX`` flag.
537+
receiving a user-provided callback to be used to generate such strings.
539538

540539
For each log entry, the callback will be invoked with a ``LogMessageInfo``
541540
struct containing the severity, filename, line number, thread ID, and time of

bazel/glog.bzl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs):
5959
"-DHAVE_CXX11_NULLPTR_T",
6060
"-DHAVE_STDINT_H",
6161
"-DHAVE_STRING_H",
62-
"-DGLOG_CUSTOM_PREFIX_SUPPORT",
6362
"-I%s/glog_internal" % gendir,
6463
] + (["-DHAVE_LIB_GFLAGS"] if with_gflags else [])
6564

@@ -205,7 +204,6 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs):
205204
"cleanup_with_absolute_prefix",
206205
"cleanup_with_relative_prefix",
207206
# "demangle", # Broken
208-
# "logging_custom_prefix", # Broken
209207
# "logging", # Broken
210208
# "mock-log", # Broken
211209
# "signalhandler", # Pointless

src/glog/logging.h.in

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ struct GLOG_EXPORT LogMessageTime {
155155
void CalcGmtOffset();
156156
};
157157

158-
#ifdef GLOG_CUSTOM_PREFIX_SUPPORT
159158
struct LogMessageInfo {
160159
explicit LogMessageInfo(const char* const severity_,
161160
const char* const filename_,
@@ -175,8 +174,6 @@ struct LogMessageInfo {
175174

176175
typedef void(*CustomPrefixCallback)(std::ostream& s, const LogMessageInfo& l, void* data);
177176

178-
#endif
179-
180177
@ac_google_end_namespace@
181178

182179

@@ -632,11 +629,9 @@ DECLARE_bool(log_utc_time);
632629
// specified by argv0 in log outputs.
633630
GLOG_EXPORT void InitGoogleLogging(const char* argv0);
634631

635-
#ifdef GLOG_CUSTOM_PREFIX_SUPPORT
636632
GLOG_EXPORT void InitGoogleLogging(const char* argv0,
637633
CustomPrefixCallback prefix_callback,
638634
void* prefix_callback_data = NULL);
639-
#endif
640635

641636
// Check if google's logging library has been initialized.
642637
GLOG_EXPORT bool IsGoogleLoggingInitialized();

src/logging.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -420,14 +420,12 @@ static bool SendEmailInternal(const char*dest, const char *subject,
420420
base::Logger::~Logger() {
421421
}
422422

423-
#ifdef GLOG_CUSTOM_PREFIX_SUPPORT
424423
namespace {
425424
// Optional user-configured callback to print custom prefixes.
426425
CustomPrefixCallback custom_prefix_callback = NULL;
427426
// User-provided data to pass to the callback:
428427
void* custom_prefix_callback_data = NULL;
429428
}
430-
#endif
431429

432430
namespace {
433431

@@ -1687,9 +1685,7 @@ void LogMessage::Init(const char* file,
16871685
std::ios saved_fmt(NULL);
16881686
saved_fmt.copyfmt(stream());
16891687
stream().fill('0');
1690-
#ifdef GLOG_CUSTOM_PREFIX_SUPPORT
16911688
if (custom_prefix_callback == NULL) {
1692-
#endif
16931689
stream() << LogSeverityNames[severity][0];
16941690
if (FLAGS_log_year_in_prefix) {
16951691
stream() << setw(4) << 1900 + logmsgtime_.year();
@@ -1706,7 +1702,6 @@ void LogMessage::Init(const char* file,
17061702
<< static_cast<unsigned int>(GetTID()) << setfill('0')
17071703
<< ' '
17081704
<< data_->basename_ << ':' << data_->line_ << "] ";
1709-
#ifdef GLOG_CUSTOM_PREFIX_SUPPORT
17101705
} else {
17111706
custom_prefix_callback(
17121707
stream(),
@@ -1717,7 +1712,6 @@ void LogMessage::Init(const char* file,
17171712
);
17181713
stream() << " ";
17191714
}
1720-
#endif
17211715
stream().copyfmt(saved_fmt);
17221716
}
17231717
data_->num_prefix_chars_ = data_->stream_.pcount();
@@ -2649,15 +2643,13 @@ void InitGoogleLogging(const char* argv0) {
26492643
glog_internal_namespace_::InitGoogleLoggingUtilities(argv0);
26502644
}
26512645

2652-
#ifdef GLOG_CUSTOM_PREFIX_SUPPORT
26532646
void InitGoogleLogging(const char* argv0,
26542647
CustomPrefixCallback prefix_callback,
26552648
void* prefix_callback_data) {
26562649
custom_prefix_callback = prefix_callback;
26572650
custom_prefix_callback_data = prefix_callback_data;
26582651
InitGoogleLogging(argv0);
26592652
}
2660-
#endif
26612653

26622654
void ShutdownGoogleLogging() {
26632655
glog_internal_namespace_::ShutdownGoogleLoggingUtilities();

0 commit comments

Comments
 (0)