From 1e6b9f3291379d7670b979d7b9e8c244b4f75d10 Mon Sep 17 00:00:00 2001 From: sukill Date: Wed, 4 Sep 2019 18:39:21 +0900 Subject: [PATCH 01/24] declare FLAGS_vmodule --- src/glog/logging.h.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/glog/logging.h.in b/src/glog/logging.h.in index 9968b96..d42f462 100644 --- a/src/glog/logging.h.in +++ b/src/glog/logging.h.in @@ -370,6 +370,8 @@ DECLARE_string(log_link); DECLARE_int32(v); // in vlog_is_on.cc +DECLARE_string(vmodule); // also in vlog_is_on.cc + // Sets the maximum log file size (in MB). DECLARE_int32(max_log_size); From 0a6704b4396ad7de2a55324ae4ebae5d9a16f403 Mon Sep 17 00:00:00 2001 From: Alex Stewart Date: Mon, 2 Dec 2019 16:07:50 +0000 Subject: [PATCH 02/24] Fix missing deletion of custom Logger - If the user specifies a custom Logger via SetLogger(), the docs state that the logging module takes ownership of it. Prior to this change, the logging library was not deleting a custom logger when the LogDestination which owns it was destroyed. --- src/logging.cc | 9 ++++++++- src/logging_unittest.cc | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/src/logging.cc b/src/logging.cc index 42cfd01..91745a1 100644 --- a/src/logging.cc +++ b/src/logging.cc @@ -495,7 +495,7 @@ class LogDestination { private: LogDestination(LogSeverity severity, const char* base_filename); - ~LogDestination() { } + ~LogDestination(); // Take a log message of a particular severity and log it to stderr // iff it's of a high enough severity to deserve it. @@ -582,6 +582,13 @@ LogDestination::LogDestination(LogSeverity severity, logger_(&fileobject_) { } +LogDestination::~LogDestination() { + if (logger_ && logger_ != &fileobject_) { + // Delete user-specified logger set via SetLogger(). + delete logger_; + } +} + inline void LogDestination::FlushLogFilesUnsafe(int min_severity) { // assume we have the log_mutex or we simply don't care // about it diff --git a/src/logging_unittest.cc b/src/logging_unittest.cc index a980677..73d426b 100644 --- a/src/logging_unittest.cc +++ b/src/logging_unittest.cc @@ -114,6 +114,7 @@ static void TestExtension(); static void TestWrapper(); static void TestErrno(); static void TestTruncate(); +static void TestCustomLoggerDeletionOnShutdown(); static int x = -1; static void BM_Check1(int n) { @@ -241,8 +242,7 @@ int main(int argc, char **argv) { TestWrapper(); TestErrno(); TestTruncate(); - - ShutdownGoogleLogging(); + TestCustomLoggerDeletionOnShutdown(); fprintf(stdout, "PASS\n"); return 0; @@ -937,6 +937,39 @@ static void TestTruncate() { #endif } +struct RecordDeletionLogger : public base::Logger { + RecordDeletionLogger(bool* set_on_destruction, + base::Logger* wrapped_logger) : + set_on_destruction_(set_on_destruction), + wrapped_logger_(wrapped_logger) + { + *set_on_destruction_ = false; + } + virtual ~RecordDeletionLogger() { + *set_on_destruction_ = true; + } + virtual void Write(bool force_flush, + time_t timestamp, + const char* message, + int length) { + wrapped_logger_->Write(force_flush, timestamp, message, length); + } + virtual void Flush() { wrapped_logger_->Flush(); } + virtual uint32 LogSize() { return wrapped_logger_->LogSize(); } + private: + bool* set_on_destruction_; + base::Logger* wrapped_logger_; +}; + +static void TestCustomLoggerDeletionOnShutdown() { + bool custom_logger_deleted = false; + base::SetLogger(GLOG_INFO, + new RecordDeletionLogger(&custom_logger_deleted, + base::GetLogger(GLOG_INFO))); + ShutdownGoogleLogging(); + EXPECT_TRUE(custom_logger_deleted); +} + _START_GOOGLE_NAMESPACE_ namespace glog_internal_namespace_ { extern // in logging.cc From a35e612c553f2dc600333b972b0fee6d20c25baa Mon Sep 17 00:00:00 2001 From: Changli Gao Date: Sat, 21 Dec 2019 23:24:28 +0800 Subject: [PATCH 03/24] Don't call close(2) more than once Don't call close(2) more then once, even though close(2) returns -1. See the manual page for details. --- src/symbolize.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/symbolize.cc b/src/symbolize.cc index 191ef38..459091c 100644 --- a/src/symbolize.cc +++ b/src/symbolize.cc @@ -374,7 +374,7 @@ struct FileDescriptor { explicit FileDescriptor(int fd) : fd_(fd) {} ~FileDescriptor() { if (fd_ >= 0) { - NO_INTR(close(fd_)); + close(fd_); } } int get() { return fd_; } From 130a3e10de248344cdaeda54aed4c8a5ad7cedac Mon Sep 17 00:00:00 2001 From: Michael Spang Date: Wed, 8 Jan 2020 01:34:39 -0500 Subject: [PATCH 04/24] Use file offsets in traces if object has no symbols (#513) Fallback to using file offsets if no symbol is found, like we do if the object could not be opened. This makes backtraces usable even if objects in the trace are stripped, since the trace can be symbolized by post-processing it with a tool like asan_symbolize.py. Note that this is not currently compatible with SymbolizeCallback as this overwrites the filename in the buffer. The behavior is unchanged in that case. Closes: #514 --- CMakeLists.txt | 2 +- configure.ac | 4 ++-- src/config.h.cmake.in | 2 +- src/symbolize.cc | 16 ++++++++++++++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e961de..92c0e34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ option (WITH_THREADS "Enable multithreading support" ON) option (WITH_TLS "Enable Thread Local Storage (TLS) support" ON) option (BUILD_SHARED_LIBS "Build shared libraries" OFF) option (PRINT_UNSYMBOLIZED_STACK_TRACES - "Print raw pc values on symbolization failure" OFF) + "Print file offsets in traces instead of symbolizing" OFF) option (WITH_PKGCONFIG "Enable pkg-config support" ON) option (WITH_UNWIND "Enable libunwind support" ON) diff --git a/configure.ac b/configure.ac index 02c118c..80005c2 100644 --- a/configure.ac +++ b/configure.ac @@ -209,11 +209,11 @@ AC_DEFINE_UNQUOTED(TEST_SRC_DIR, "$srcdir", [location of source code]) AC_ARG_ENABLE(unsymbolized-traces, AS_HELP_STRING([--enable-unsymbolized-traces], - [Print raw pc values when symbolization is failed.]), + [Print file offsets in traces instead of symbolizing.]), enable_unsymbolized_traces=yes) if test x"$enable_unsymbolized_traces" = x"yes"; then AC_DEFINE(PRINT_UNSYMBOLIZED_STACK_TRACES, 1, - [define if we should print raw pc values on symbolization failure.]) + [define if we should print file offsets in traces instead of symbolizing.]) fi # These are what's needed by logging.h.in and raw_logging.h.in diff --git a/src/config.h.cmake.in b/src/config.h.cmake.in index f038de2..20f0990 100644 --- a/src/config.h.cmake.in +++ b/src/config.h.cmake.in @@ -170,7 +170,7 @@ /* How to access the PC from a struct ucontext */ #cmakedefine PC_FROM_UCONTEXT -/* define if we should print raw pc values on symbolization failure. */ +/* define if we should print file offsets in traces instead of symbolizing. */ #cmakedefine PRINT_UNSYMBOLIZED_STACK_TRACES /* Define to necessary symbol if this constant uses a non-standard name on diff --git a/src/symbolize.cc b/src/symbolize.cc index 459091c..76a1b0f 100644 --- a/src/symbolize.cc +++ b/src/symbolize.cc @@ -312,6 +312,7 @@ FindSymbol(uint64_t pc, const int fd, char *out, int out_size, ssize_t len1 = ReadFromOffset(fd, out, out_size, strtab->sh_offset + symbol.st_name); if (len1 <= 0 || memchr(out, '\0', out_size) == NULL) { + memset(out, 0, out_size); return false; } return true; // Obtained the symbol name. @@ -783,9 +784,10 @@ static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out, out_size - 1); } + FileDescriptor wrapped_object_fd(object_fd); + #if defined(PRINT_UNSYMBOLIZED_STACK_TRACES) { - FileDescriptor wrapped_object_fd(object_fd); #else // Check whether a file name was returned. if (object_fd < 0) { @@ -804,7 +806,6 @@ static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out, // Failed to determine the object file containing PC. Bail out. return false; } - FileDescriptor wrapped_object_fd(object_fd); int elf_type = FileGetElfType(wrapped_object_fd.get()); if (elf_type == -1) { return false; @@ -824,6 +825,17 @@ static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out, } if (!GetSymbolFromObjectFile(wrapped_object_fd.get(), pc0, out, out_size, base_address)) { + if (out[1] && !g_symbolize_callback) { + // The object file containing PC was opened successfully however the + // symbol was not found. The object may have been stripped. This is still + // considered success because the object file name and offset are known + // and tools like asan_symbolize.py can be used for the symbolization. + out[out_size - 1] = '\0'; // Making sure |out| is always null-terminated. + SafeAppendString("+0x", out, out_size); + SafeAppendHexNumber(pc0 - base_address, out, out_size); + SafeAppendString(")", out, out_size); + return true; + } return false; } From 74076bebc387bf6ab9e4e43724fd86d5a94e73d5 Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Fri, 10 Jan 2020 10:50:12 +0000 Subject: [PATCH 05/24] Explain log levels. --- src/glog/log_severity.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/glog/log_severity.h b/src/glog/log_severity.h index 99945a4..987cc57 100644 --- a/src/glog/log_severity.h +++ b/src/glog/log_severity.h @@ -30,6 +30,21 @@ #ifndef BASE_LOG_SEVERITY_H__ #define BASE_LOG_SEVERITY_H__ +// The recommended semantics of the log levels are as follows: +// +// INFO: +// Use for state changes or other major events, or to aid debugging. +// WARNING: +// Use for undesired but relatively expected events, which may indicate a +// problem +// ERROR: +// Use for undesired and unexpected events that the program can recover from. +// All ERRORs should be actionable - it should be appropriate to file a bug +// whenever an ERROR occurs in production. +// FATAL: +// Use for undesired and unexpected events that the program cannot recover +// from. + // Annoying stuff for windows -- makes sure clients can import these functions #ifndef GOOGLE_GLOG_DLL_DECL # if defined(_WIN32) && !defined(__CYGWIN__) From 195d416e3b1c8dc06980439f6acd3ebd40b6b820 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 17 Jan 2020 00:17:28 -0800 Subject: [PATCH 06/24] Add target existence checks to Unwind find module (#518) * Add target existence checks to Unwind find module The build systems of projects depending on Glog may call the Unwind find module multiple times. In these cases, the current unwind find module tries to create a duplicate unwind::unwind target, crashing the build. This patch adds an existence check before target creation to fix this issue. Signed-off-by: Michael Darr * Alphabetize contributor list * Fix inconsistent CMake style Signed-off-by: Michael Darr --- CONTRIBUTORS | 1 + cmake/FindUnwind.cmake | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index f4b011f..d90f859 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -34,6 +34,7 @@ Ivan Penkov Jacob Trimble Jim Ray Marco Wang +Michael Darr Michael Tanner MiniLight Peter Collingbourne diff --git a/cmake/FindUnwind.cmake b/cmake/FindUnwind.cmake index ae530df..8941bb0 100644 --- a/cmake/FindUnwind.cmake +++ b/cmake/FindUnwind.cmake @@ -62,15 +62,17 @@ find_package_handle_standard_args (Unwind REQUIRED_VARS Unwind_INCLUDE_DIR Unwind_LIBRARY Unwind_PLATFORM_LIBRARY VERSION_VAR Unwind_VERSION) if (Unwind_FOUND) - add_library (unwind::unwind INTERFACE IMPORTED) + if (NOT TARGET unwind::unwind) + add_library (unwind::unwind INTERFACE IMPORTED) - set_property (TARGET unwind::unwind PROPERTY - INTERFACE_INCLUDE_DIRECTORIES ${Unwind_INCLUDE_DIR} - ) - set_property (TARGET unwind::unwind PROPERTY - INTERFACE_LINK_LIBRARIES ${Unwind_LIBRARY} ${Unwind_PLATFORM_LIBRARY} - ) - set_property (TARGET unwind::unwind PROPERTY - IMPORTED_CONFIGURATIONS RELEASE - ) + set_property (TARGET unwind::unwind PROPERTY + INTERFACE_INCLUDE_DIRECTORIES ${Unwind_INCLUDE_DIR} + ) + set_property (TARGET unwind::unwind PROPERTY + INTERFACE_LINK_LIBRARIES ${Unwind_LIBRARY} ${Unwind_PLATFORM_LIBRARY} + ) + set_property (TARGET unwind::unwind PROPERTY + IMPORTED_CONFIGURATIONS RELEASE + ) + endif (NOT TARGET unwind::unwind) endif (Unwind_FOUND) From eb13e4f67c57ba2ec3479ded13d9bb2395331871 Mon Sep 17 00:00:00 2001 From: Ed Baunton Date: Thu, 6 Feb 2020 17:59:13 -0500 Subject: [PATCH 07/24] Allow CMake user to disable Symbolize functionality Currently the user has to rely on the HAVE_SYMBOLIZE detection inside CMakeLists.txt without having any control over whether it should be used. Add support for disabling HAVE_SYMBOLIZE at configure time so user can specify `cmake -DHAVE_SYMBOLIZE=0`. Signed-off-by: Ed Baunton --- CMakeLists.txt | 59 ++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 92c0e34..c8773af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ option (PRINT_UNSYMBOLIZED_STACK_TRACES "Print file offsets in traces instead of symbolizing" OFF) option (WITH_PKGCONFIG "Enable pkg-config support" ON) option (WITH_UNWIND "Enable libunwind support" ON) +option (WITH_SYMBOLIZE "Enable symbolize module" ON) if (NOT WITH_UNWIND) set (CMAKE_DISABLE_FIND_PACKAGE_Unwind ON) @@ -365,44 +366,46 @@ if (HAVE_EXECINFO_H) set (HAVE_STACKTRACE 1) endif (HAVE_EXECINFO_H) -if (WIN32 OR CYGWIN) - cmake_push_check_state (RESET) - set (CMAKE_REQUIRED_LIBRARIES DbgHelp) +if (WITH_SYMBOLIZE) + if (WIN32 OR CYGWIN) + cmake_push_check_state (RESET) + set (CMAKE_REQUIRED_LIBRARIES DbgHelp) - check_cxx_source_runs ([=[ - #include - #include - #include + check_cxx_source_runs ([=[ + #include + #include + #include - void foobar() { } + void foobar() { } - int main() - { - HANDLE process = GetCurrentProcess(); + int main() + { + HANDLE process = GetCurrentProcess(); - if (!SymInitialize(process, NULL, TRUE)) - return EXIT_FAILURE; + if (!SymInitialize(process, NULL, TRUE)) + return EXIT_FAILURE; - char buf[sizeof(SYMBOL_INFO) + MAX_SYM_NAME]; - SYMBOL_INFO *symbol = reinterpret_cast(buf); - symbol->SizeOfStruct = sizeof(SYMBOL_INFO); - symbol->MaxNameLen = MAX_SYM_NAME; + char buf[sizeof(SYMBOL_INFO) + MAX_SYM_NAME]; + SYMBOL_INFO *symbol = reinterpret_cast(buf); + symbol->SizeOfStruct = sizeof(SYMBOL_INFO); + symbol->MaxNameLen = MAX_SYM_NAME; - void* const pc = reinterpret_cast(&foobar); - BOOL ret = SymFromAddr(process, reinterpret_cast(pc), 0, symbol); + void* const pc = reinterpret_cast(&foobar); + BOOL ret = SymFromAddr(process, reinterpret_cast(pc), 0, symbol); - return ret ? EXIT_SUCCESS : EXIT_FAILURE; - } - ]=] HAVE_SYMBOLIZE) + return ret ? EXIT_SUCCESS : EXIT_FAILURE; + } + ]=] HAVE_SYMBOLIZE) cmake_pop_check_state () - if (HAVE_SYMBOLIZE) - set (HAVE_STACKTRACE 1) - endif (HAVE_SYMBOLIZE) -elseif (UNIX OR (APPLE AND HAVE_DLADDR)) - set (HAVE_SYMBOLIZE 1) -endif (WIN32 OR CYGWIN) + if (HAVE_SYMBOLIZE) + set (HAVE_STACKTRACE 1) + endif (HAVE_SYMBOLIZE) + elseif (UNIX OR (APPLE AND HAVE_DLADDR)) + set (HAVE_SYMBOLIZE 1) + endif (WIN32 OR CYGWIN) +endif (WITH_SYMBOLIZE) check_cxx_source_compiles (" #include From 940335d82fb1a37ad52dd2bb42836de2d74a3dd5 Mon Sep 17 00:00:00 2001 From: Lily <47812810+LilyWangL@users.noreply.github.com> Date: Wed, 25 Mar 2020 16:08:16 +0800 Subject: [PATCH 08/24] Add vcpkg installation instructions (#517) Add vcpkg installation instructions --- INSTALL | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/INSTALL b/INSTALL index 0f3b55d..e9530ac 100644 --- a/INSTALL +++ b/INSTALL @@ -130,6 +130,22 @@ The simplest way to compile this package is: 6. Often, you can also type `make uninstall' to remove the installed files again. + +Building glog - Using vcpkg +=========================== + +The url of vcpkg is: https://github.com/Microsoft/vcpkg +You can download and install glog using the vcpkg dependency manager: + + git clone https://github.com/Microsoft/vcpkg.git + cd vcpkg + ./bootstrap-vcpkg.sh + ./vcpkg integrate install + ./vcpkg install glog + +The glog port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository. + + Compilers and Options ===================== From 5b4fb63d277795eea3400e3e6af542f3b765f2d2 Mon Sep 17 00:00:00 2001 From: Marco Date: Wed, 25 Mar 2020 16:36:28 +0800 Subject: [PATCH 09/24] Prepend the year to each glog line (#516) (#530) * Prepend the year to each glog line (#516) This PR fixes issue #516 by prepending the year to each glog line. Previous format of each line in a log file: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg New format: [IWEF]yyyymmdd hh:mm:ss.uuuuuu threadid file:line] msg * Fix logging_unittest for PR #530 Since the format of each glog line has been changed, the logging_unittest must also be updated. --- src/glog/logging.h.in | 3 +- src/glog/raw_logging.h.in | 4 +- src/googletest.h | 14 +- src/logging.cc | 8 +- src/logging_unittest.err | 610 ++++++++++++++++++------------------- src/raw_logging.cc | 2 +- src/windows/glog/logging.h | 3 +- 7 files changed, 324 insertions(+), 320 deletions(-) diff --git a/src/glog/logging.h.in b/src/glog/logging.h.in index 64bed1a..1e552fc 100644 --- a/src/glog/logging.h.in +++ b/src/glog/logging.h.in @@ -280,12 +280,13 @@ typedef unsigned __int64 uint64; // // Log lines have this form: // -// Lmmdd hh:mm:ss.uuuuuu threadid file:line] msg... +// Lyyyymmdd hh:mm:ss.uuuuuu threadid file:line] msg... // // where the fields are defined as follows: // // L A single character, representing the log level // (eg 'I' for INFO) +// yyyy The year // mm The month (zero padded; ie May is '05') // dd The day (zero padded) // hh:mm:ss.uuuuuu Time in hours, minutes and fractional seconds diff --git a/src/glog/raw_logging.h.in b/src/glog/raw_logging.h.in index 3eac56a..31b7ed3 100644 --- a/src/glog/raw_logging.h.in +++ b/src/glog/raw_logging.h.in @@ -64,8 +64,8 @@ // RAW_LOG(ERROR, "Failed foo with %i: %s", status, error); // RAW_VLOG(3, "status is %i", status); // These will print an almost standard log lines like this to stderr only: -// E0821 211317 file.cc:123] RAW: Failed foo with 22: bad_file -// I0821 211317 file.cc:142] RAW: status is 20 +// E20200821 211317 file.cc:123] RAW: Failed foo with 22: bad_file +// I20200821 211317 file.cc:142] RAW: status is 20 #define RAW_LOG(severity, ...) \ do { \ switch (@ac_google_namespace@::GLOG_ ## severity) { \ diff --git a/src/googletest.h b/src/googletest.h index 31a6a44..a9e7795 100644 --- a/src/googletest.h +++ b/src/googletest.h @@ -385,12 +385,12 @@ static inline string GetCapturedTestStderr() { return GetCapturedTestOutput(STDERR_FILENO); } -// Check if the string is [IWEF](\d{4}|DATE) +// Check if the string is [IWEF](\d{8}|YEARDATE) static inline bool IsLoggingPrefix(const string& s) { - if (s.size() != 5) return false; + if (s.size() != 9) return false; if (!strchr("IWEF", s[0])) return false; - for (int i = 1; i <= 4; ++i) { - if (!isdigit(s[i]) && s[i] != "DATE"[i-1]) return false; + for (int i = 1; i <= 8; ++i) { + if (!isdigit(s[i]) && s[i] != "YEARDATE"[i-1]) return false; } return true; } @@ -398,8 +398,8 @@ static inline bool IsLoggingPrefix(const string& s) { // Convert log output into normalized form. // // Example: -// I0102 030405 logging_unittest.cc:345] RAW: vlog -1 -// => IDATE TIME__ logging_unittest.cc:LINE] RAW: vlog -1 +// I20200102 030405 logging_unittest.cc:345] RAW: vlog -1 +// => IYEARDATE TIME__ logging_unittest.cc:LINE] RAW: vlog -1 static inline string MungeLine(const string& line) { std::istringstream iss(line); string before, logcode_date, time, thread_lineinfo; @@ -428,7 +428,7 @@ static inline string MungeLine(const string& line) { thread_lineinfo = thread_lineinfo.substr(0, index+1) + "LINE]"; string rest; std::getline(iss, rest); - return (before + logcode_date[0] + "DATE TIME__ " + thread_lineinfo + + return (before + logcode_date[0] + "YEARDATE TIME__ " + thread_lineinfo + MungeLine(rest)); } diff --git a/src/logging.cc b/src/logging.cc index 42cfd01..e0353e2 100644 --- a/src/logging.cc +++ b/src/logging.cc @@ -1209,7 +1209,7 @@ void LogFileObject::Write(bool force_flush, << setw(2) << tm_time.tm_sec << '\n' << "Running on machine: " << LogDestination::hostname() << '\n' - << "Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu " + << "Log line format: [IWEF]yyyymmdd hh:mm:ss.uuuuuu " << "threadid file:line] msg" << '\n'; const string& file_header_string = file_header_stream.str(); @@ -1421,11 +1421,12 @@ void LogMessage::Init(const char* file, data_->has_been_flushed_ = false; // If specified, prepend a prefix to each line. For example: - // I1018 160715 f5d4fbb0 logging.cc:1153] - // (log level, GMT month, date, time, thread_id, file basename, line) + // I20201018 160715 f5d4fbb0 logging.cc:1153] + // (log level, GMT year, month, date, time, thread_id, file basename, line) // We exclude the thread_id for the default thread. if (FLAGS_log_prefix && (line != kNoLogPrefix)) { stream() << LogSeverityNames[severity][0] + << setw(4) << 1900+data_->tm_time_.tm_year << setw(2) << 1+data_->tm_time_.tm_mon << setw(2) << data_->tm_time_.tm_mday << ' ' @@ -1827,6 +1828,7 @@ string LogSink::ToString(LogSeverity severity, const char* file, int line, stream.fill('0'); stream << LogSeverityNames[severity][0] + << setw(4) << 1900+tm_time->tm_year << setw(2) << 1+tm_time->tm_mon << setw(2) << tm_time->tm_mday << ' ' diff --git a/src/logging_unittest.err b/src/logging_unittest.err index 2ecc1b0..def0e93 100644 --- a/src/logging_unittest.err +++ b/src/logging_unittest.err @@ -1,307 +1,307 @@ -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=2 logtostderr=0 alsologtostderr=0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info -WDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=2 logtostderr=0 alsologtostderr=0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error WARNING: Logging before InitGoogleLogging() is written to STDERR -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] log info -WDATE TIME__ THREADID logging_unittest.cc:LINE] log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info -WDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=0 logtostderr=0 alsologtostderr=0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info -WDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] log info -WDATE TIME__ THREADID logging_unittest.cc:LINE] log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info -WDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] foo bar 10 3.4 -EDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 1: __SUCCESS__ [0] -EDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 3, iteration 1 -EDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 4, iteration 1 -WDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 5, iteration 1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 1 -EDATE TIME__ THREADID logging_unittest.cc:LINE] Log if less than 3 every 2, iteration 1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 2 -EDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 3: __ENOENT__ [2] -IDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 3 -EDATE TIME__ THREADID logging_unittest.cc:LINE] Log if less than 3 every 2, iteration 3 -EDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 3, iteration 4 -IDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 4 -EDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 5: __EINTR__ [4] -EDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 4, iteration 5 -IDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 5 -WDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 5, iteration 6 -IDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 6 -EDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 7: __ENXIO__ [6] -EDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 3, iteration 7 -IDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 7 -IDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 8 -EDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 9: __ENOEXEC__ [8] -EDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 4, iteration 9 -IDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 9 -EDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 3, iteration 10 -IDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 10 -WDATE TIME__ THREADID logging_unittest.cc:LINE] log_if this -IDATE TIME__ THREADID logging_unittest.cc:LINE] array -IDATE TIME__ THREADID logging_unittest.cc:LINE] const array -EDATE TIME__ THREADID logging_unittest.cc:LINE] foo 1000 0000001000 3e8 -EDATE TIME__ THREADID logging_unittest.cc:LINE] inner -EDATE TIME__ THREADID logging_unittest.cc:LINE] outer +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=0 logtostderr=0 alsologtostderr=0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] foo bar 10 3.4 +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 1: __SUCCESS__ [0] +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 3, iteration 1 +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 4, iteration 1 +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 5, iteration 1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 1 +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if less than 3 every 2, iteration 1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 2 +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 3: __ENOENT__ [2] +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 3 +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if less than 3 every 2, iteration 3 +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 3, iteration 4 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 4 +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 5: __EINTR__ [4] +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 4, iteration 5 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 5 +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 5, iteration 6 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 6 +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 7: __ENXIO__ [6] +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 3, iteration 7 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 7 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 8 +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 9: __ENOEXEC__ [8] +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 4, iteration 9 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 9 +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 3, iteration 10 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 10 +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if this +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] array +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] const array +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] foo 1000 0000001000 3e8 +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] inner +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] outer no prefix -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: foo bar 10 3.400000 -WDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: array -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: const array -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: ptr __PTRTEST__ -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: ptr __NULLP__ -EDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: foo 1000 0000001000 3e8 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: foo 1000 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: foo 1000 -WDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: RAW_LOG ERROR: The Message was too long! -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: RAW_LOG ERROR: The Message was too long! -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0 on -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 1 on -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 2 on -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=0 logtostderr=0 alsologtostderr=0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info -WDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] log info -WDATE TIME__ THREADID logging_unittest.cc:LINE] log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info -WDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=1 stderrthreshold=0 logtostderr=0 alsologtostderr=0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info -WDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] log info -WDATE TIME__ THREADID logging_unittest.cc:LINE] log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info -WDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=-1 stderrthreshold=0 logtostderr=0 alsologtostderr=0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info -WDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] log info -WDATE TIME__ THREADID logging_unittest.cc:LINE] log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info -WDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=1 logtostderr=0 alsologtostderr=0 -WDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error -WDATE TIME__ THREADID logging_unittest.cc:LINE] log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log error -WDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=2 logtostderr=0 alsologtostderr=0 -EDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error -EDATE TIME__ THREADID logging_unittest.cc:LINE] log error -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=3 logtostderr=0 alsologtostderr=0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=3 logtostderr=1 alsologtostderr=0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info -WDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] log info -WDATE TIME__ THREADID logging_unittest.cc:LINE] log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info -WDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=3 logtostderr=0 alsologtostderr=1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info -WDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] log info -WDATE TIME__ THREADID logging_unittest.cc:LINE] log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info -WDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=1 stderrthreshold=1 logtostderr=0 alsologtostderr=0 -WDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error -WDATE TIME__ THREADID logging_unittest.cc:LINE] log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log error -WDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=1 stderrthreshold=3 logtostderr=0 alsologtostderr=1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info -WDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] log info -WDATE TIME__ THREADID logging_unittest.cc:LINE] log warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info -WDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr -EDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr -IDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_STRING: reported info -WDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_STRING: reported warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_STRING: reported error -IDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_STRING: LOG_STRING: collected info -IDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_STRING: LOG_STRING: collected warning -IDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_STRING: LOG_STRING: collected error -IDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected info -WDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected error -IDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: reported info -WDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: reported warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: reported error -IDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_SINK: -IDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected info -WDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected error -IDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK_BUT_NOT_TO_LOGFILE: collected info -WDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK_BUT_NOT_TO_LOGFILE: collected warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK_BUT_NOT_TO_LOGFILE: collected error -IDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: collected info -IDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_STRING: LOG_TO_STRING: collected info -WDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: collected warning -IDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_STRING: LOG_TO_STRING: collected warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: collected error -IDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_STRING: LOG_TO_STRING: collected error -IDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: reported info -WDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: reported warning -EDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: reported error -IDATE TIME__ THREADID logging_unittest.cc:LINE] Message 1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Buffering -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Buffered -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Waiting -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Sink got a messages -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Waited -IDATE TIME__ THREADID logging_unittest.cc:LINE] Sink is sending out a message: IDATE TIME__ THREADID logging_unittest.cc:LINE] Message 1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] Have 0 left -EDATE TIME__ THREADID logging_unittest.cc:LINE] Message 2 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Buffering -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Buffered -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Waiting -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Sink got a messages -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Waited -IDATE TIME__ THREADID logging_unittest.cc:LINE] Sink is sending out a message: EDATE TIME__ THREADID logging_unittest.cc:LINE] Message 2 -IDATE TIME__ THREADID logging_unittest.cc:LINE] Have 0 left -WDATE TIME__ THREADID logging_unittest.cc:LINE] Message 3 -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Buffering -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Buffered -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Waiting -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Sink got a messages -IDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Waited -IDATE TIME__ THREADID logging_unittest.cc:LINE] Sink is sending out a message: WDATE TIME__ THREADID logging_unittest.cc:LINE] Message 3 -IDATE TIME__ THREADID logging_unittest.cc:LINE] Have 0 left -IDATE TIME__ THREADID logging_unittest.cc:LINE] Sink capture: IDATE TIME__ THREADID logging_unittest.cc:LINE] Message 1 -IDATE TIME__ THREADID logging_unittest.cc:LINE] Sink capture: EDATE TIME__ THREADID logging_unittest.cc:LINE] Message 2 -IDATE TIME__ THREADID logging_unittest.cc:LINE] Sink capture: WDATE TIME__ THREADID logging_unittest.cc:LINE] Message 3 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: foo bar 10 3.400000 +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: array +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: const array +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: ptr __PTRTEST__ +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: ptr __NULLP__ +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: foo 1000 0000001000 3e8 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: foo 1000 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: foo 1000 +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: RAW_LOG ERROR: The Message was too long! +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: RAW_LOG ERROR: The Message was too long! +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0 on +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 1 on +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 2 on +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=0 logtostderr=0 alsologtostderr=0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=1 stderrthreshold=0 logtostderr=0 alsologtostderr=0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=-1 stderrthreshold=0 logtostderr=0 alsologtostderr=0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=1 logtostderr=0 alsologtostderr=0 +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=2 logtostderr=0 alsologtostderr=0 +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=3 logtostderr=0 alsologtostderr=0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=3 logtostderr=1 alsologtostderr=0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=3 logtostderr=0 alsologtostderr=1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=1 stderrthreshold=1 logtostderr=0 alsologtostderr=0 +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=1 stderrthreshold=3 logtostderr=0 alsologtostderr=1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_STRING: reported info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_STRING: reported warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_STRING: reported error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_STRING: LOG_STRING: collected info +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_STRING: LOG_STRING: collected warning +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_STRING: LOG_STRING: collected error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: reported info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: reported warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: reported error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_SINK: +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK_BUT_NOT_TO_LOGFILE: collected info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK_BUT_NOT_TO_LOGFILE: collected warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK_BUT_NOT_TO_LOGFILE: collected error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: collected info +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_STRING: LOG_TO_STRING: collected info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: collected warning +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_STRING: LOG_TO_STRING: collected warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: collected error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_STRING: LOG_TO_STRING: collected error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: reported info +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: reported warning +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: reported error +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Buffering +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Buffered +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Waiting +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Sink got a messages +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Waited +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink is sending out a message: IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Have 0 left +EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 2 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Buffering +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Buffered +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Waiting +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Sink got a messages +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Waited +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink is sending out a message: EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 2 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Have 0 left +WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 3 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Buffering +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Buffered +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Waiting +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Sink got a messages +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Waited +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink is sending out a message: WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 3 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Have 0 left +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink capture: IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 1 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink capture: EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 2 +IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink capture: WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 3 diff --git a/src/raw_logging.cc b/src/raw_logging.cc index 3bbfda3..ba65961 100644 --- a/src/raw_logging.cc +++ b/src/raw_logging.cc @@ -114,7 +114,7 @@ void RawLog__(LogSeverity severity, const char* file, int line, int size = sizeof(buffer); // NOTE: this format should match the specification in base/logging.h - DoRawLog(&buf, &size, "%c0000 00:00:00.000000 %5u %s:%d] RAW: ", + DoRawLog(&buf, &size, "%c00000000 00:00:00.000000 %5u %s:%d] RAW: ", LogSeverityNames[severity][0], static_cast(GetTID()), const_basename(const_cast(file)), line); diff --git a/src/windows/glog/logging.h b/src/windows/glog/logging.h index 2a739f9..e111bf0 100755 --- a/src/windows/glog/logging.h +++ b/src/windows/glog/logging.h @@ -284,12 +284,13 @@ typedef unsigned __int64 uint64; // // Log lines have this form: // -// Lmmdd hh:mm:ss.uuuuuu threadid file:line] msg... +// Lyyyymmdd hh:mm:ss.uuuuuu threadid file:line] msg... // // where the fields are defined as follows: // // L A single character, representing the log level // (eg 'I' for INFO) +// yyyy The year // mm The month (zero padded; ie May is '05') // dd The day (zero padded) // hh:mm:ss.uuuuuu Time in hours, minutes and fractional seconds From ceb71638804c31d1a683decc46637888c9e8936c Mon Sep 17 00:00:00 2001 From: Dmitry Uspenskiy Date: Thu, 28 Feb 2019 17:25:36 +0300 Subject: [PATCH 10/24] Add extra information in log file header (application build/version, actual duration time) --- src/glog/logging.h.in | 2 +- src/logging.cc | 29 +++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/glog/logging.h.in b/src/glog/logging.h.in index 1e552fc..6b2535d 100644 --- a/src/glog/logging.h.in +++ b/src/glog/logging.h.in @@ -529,7 +529,7 @@ GOOGLE_GLOG_DLL_DECL void InstallFailureFunction(void (*fail_func)()); // Enable/Disable old log cleaner. GOOGLE_GLOG_DLL_DECL void EnableLogCleaner(int overdue_days); GOOGLE_GLOG_DLL_DECL void DisableLogCleaner(); - +GOOGLE_GLOG_DLL_DECL void SetApplicationFingerprint(const std::string& fingerprint); class LogSink; // defined below diff --git a/src/logging.cc b/src/logging.cc index ddcf910..0b3e3c4 100644 --- a/src/logging.cc +++ b/src/logging.cc @@ -450,6 +450,7 @@ class LogFileObject : public base::Logger { uint32 file_length_; unsigned int rollover_attempt_; int64 next_flush_time_; // cycle count at which to flush log + WallTime start_time_; // Actually create a logfile using the value of base_filename_ and the // optional argument time_pid_string @@ -923,11 +924,27 @@ vector GetOverdueLogNames(string log_directory, int days) { bool log_cleaner_enabled_; int log_cleaner_overdue_days_ = 7; +std::string g_application_fingerprint; + } // namespace +void SetApplicationFingerprint(const std::string& fingerprint) { + g_application_fingerprint = fingerprint; +} namespace { +string PrettyDuration(int secs) { + std::stringstream result; + int mins = secs / 60; + int hours = mins / 60; + mins = mins % 60; + secs = secs % 60; + result.fill('0'); + result << hours << ':' << setw(2) << mins << ':' << setw(2) << secs; + return result.str(); +} + LogFileObject::LogFileObject(LogSeverity severity, const char* base_filename) : base_filename_selected_(base_filename != NULL), @@ -940,7 +957,8 @@ LogFileObject::LogFileObject(LogSeverity severity, dropped_mem_length_(0), file_length_(0), rollover_attempt_(kRolloverAttemptFrequency-1), - next_flush_time_(0) { + next_flush_time_(0), + start_time_(WallTime_Now()) { assert(severity >= 0); assert(severity < NUM_SEVERITIES); } @@ -1215,7 +1233,14 @@ void LogFileObject::Write(bool force_flush, << setw(2) << tm_time.tm_min << ':' << setw(2) << tm_time.tm_sec << '\n' << "Running on machine: " - << LogDestination::hostname() << '\n' + << LogDestination::hostname() << '\n'; + + if(!g_application_fingerprint.empty()) { + file_header_stream << "Application fingerprint: " << g_application_fingerprint << '\n'; + } + + file_header_stream << "Running duration (h:mm:ss): " + << PrettyDuration(static_cast(WallTime_Now() - start_time_)) << '\n' << "Log line format: [IWEF]yyyymmdd hh:mm:ss.uuuuuu " << "threadid file:line] msg" << '\n'; const string& file_header_string = file_header_stream.str(); From 3ba8976592274bc1f907c402ce22558011d6fc5e Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Sun, 16 Feb 2020 16:43:33 +0000 Subject: [PATCH 11/24] fix bazel build for freebsd --- bazel/glog.bzl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bazel/glog.bzl b/bazel/glog.bzl index 20c4de7..1728758 100644 --- a/bazel/glog.bzl +++ b/bazel/glog.bzl @@ -48,6 +48,11 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs): "-I%s/glog_internal" % gendir, ] + freebsd_only_copts = [ + # Enable declaration of _Unwind_Backtrace + "-D_GNU_SOURCE", + ] + darwin_only_copts = [ # For stacktrace. "-DHAVE_DLADDR", @@ -99,6 +104,7 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs): select({ "@bazel_tools//src/conditions:windows": common_copts + windows_only_copts, "@bazel_tools//src/conditions:darwin": common_copts + linux_or_darwin_copts + darwin_only_copts, + "@bazel_tools//src/conditions:freebsd": common_copts + linux_or_darwin_copts + freebsd_only_copts, "//conditions:default": common_copts + linux_or_darwin_copts, }), deps = [ From 4a82a856d281e78c2af8c0ea35f0b6b8b4688598 Mon Sep 17 00:00:00 2001 From: Longwu Ou Date: Sun, 26 Apr 2020 22:57:58 -0400 Subject: [PATCH 12/24] Use NULL to indicate uninitialized VLOG_IS_ON site. --- src/glog/vlog_is_on.h.in | 15 ++++----------- src/vlog_is_on.cc | 2 -- src/windows/glog/vlog_is_on.h | 15 ++++----------- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/glog/vlog_is_on.h.in b/src/glog/vlog_is_on.h.in index 3f4c4a3..4a5bbdf 100644 --- a/src/glog/vlog_is_on.h.in +++ b/src/glog/vlog_is_on.h.in @@ -81,12 +81,11 @@ // parsing of --vmodule flag and/or SetVLOGLevel calls. #define VLOG_IS_ON(verboselevel) \ __extension__ \ - ({ static @ac_google_namespace@::int32* vlocal__ = &@ac_google_namespace@::kLogSiteUninitialized; \ + ({ static @ac_google_namespace@::int32* vlocal__ = NULL; \ @ac_google_namespace@::int32 verbose_level__ = (verboselevel); \ - (*vlocal__ >= verbose_level__) && \ - ((vlocal__ != &@ac_google_namespace@::kLogSiteUninitialized) || \ - (@ac_google_namespace@::InitVLOG3__(&vlocal__, &FLAGS_v, \ - __FILE__, verbose_level__))); }) + (vlocal__ == NULL ? @ac_google_namespace@::InitVLOG3__(&vlocal__, &FLAGS_v, \ + __FILE__, verbose_level__) : *vlocal__ >= verbose_level__); \ + }) #else // GNU extensions not available, so we do not support --vmodule. // Dynamic value of FLAGS_v always controls the logging level. @@ -106,12 +105,6 @@ extern GOOGLE_GLOG_DLL_DECL int SetVLOGLevel(const char* module_pattern, // Various declarations needed for VLOG_IS_ON above: ========================= -// Special value used to indicate that a VLOG_IS_ON site has not been -// initialized. We make this a large value, so the common-case check -// of "*vlocal__ >= verbose_level__" in VLOG_IS_ON definition -// passes in such cases and InitVLOG3__ is then triggered. -extern @ac_google_namespace@::int32 kLogSiteUninitialized; - // Helper routine which determines the logging info for a particalur VLOG site. // site_flag is the address of the site-local pointer to the controlling // verbosity level diff --git a/src/vlog_is_on.cc b/src/vlog_is_on.cc index e8fdbae..e1b257f 100644 --- a/src/vlog_is_on.cc +++ b/src/vlog_is_on.cc @@ -105,8 +105,6 @@ GOOGLE_GLOG_DLL_DECL bool SafeFNMatch_(const char* pattern, using glog_internal_namespace_::SafeFNMatch_; -int32 kLogSiteUninitialized = 1000; - // List of per-module log levels from FLAGS_vmodule. // Once created each element is never deleted/modified // except for the vlog_level: other threads will read VModuleInfo blobs diff --git a/src/windows/glog/vlog_is_on.h b/src/windows/glog/vlog_is_on.h index 409a401..3ea36b8 100755 --- a/src/windows/glog/vlog_is_on.h +++ b/src/windows/glog/vlog_is_on.h @@ -85,12 +85,11 @@ // parsing of --vmodule flag and/or SetVLOGLevel calls. #define VLOG_IS_ON(verboselevel) \ __extension__ \ - ({ static google::int32* vlocal__ = &google::kLogSiteUninitialized; \ + ({ static @ac_google_namespace@::int32* vlocal__ = NULL; \ google::int32 verbose_level__ = (verboselevel); \ - (*vlocal__ >= verbose_level__) && \ - ((vlocal__ != &google::kLogSiteUninitialized) || \ - (google::InitVLOG3__(&vlocal__, &FLAGS_v, \ - __FILE__, verbose_level__))); }) + (vlocal__ == NULL ? @ac_google_namespace@::InitVLOG3__(&vlocal__, &FLAGS_v, \ + __FILE__, verbose_level__) : *vlocal__ >= verbose_level__); \ + }) #else // GNU extensions not available, so we do not support --vmodule. // Dynamic value of FLAGS_v always controls the logging level. @@ -110,12 +109,6 @@ extern GOOGLE_GLOG_DLL_DECL int SetVLOGLevel(const char* module_pattern, // Various declarations needed for VLOG_IS_ON above: ========================= -// Special value used to indicate that a VLOG_IS_ON site has not been -// initialized. We make this a large value, so the common-case check -// of "*vlocal__ >= verbose_level__" in VLOG_IS_ON definition -// passes in such cases and InitVLOG3__ is then triggered. -extern google::int32 kLogSiteUninitialized; - // Helper routine which determines the logging info for a particalur VLOG site. // site_flag is the address of the site-local pointer to the controlling // verbosity level From 7001ab9ecba9060c3502b2872a3bab0ed3c6e8f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Wendling?= Date: Mon, 27 Apr 2020 15:50:32 +0200 Subject: [PATCH 13/24] OpenBSD/powerpc: clang does not define _CALL_* use proper ifdef OpenBSD/macppc uses now clang by default and does not define _CALL_SYSV, use the alternative for such platforms. --- src/stacktrace_powerpc-inl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stacktrace_powerpc-inl.h b/src/stacktrace_powerpc-inl.h index 03b9108..7b2bbd1 100644 --- a/src/stacktrace_powerpc-inl.h +++ b/src/stacktrace_powerpc-inl.h @@ -114,7 +114,7 @@ int GetStackTrace(void** result, int max_depth, int skip_count) { #elif defined(__APPLE__) || ((defined(__linux) || defined(__linux__)) && defined(__PPC64__)) // This check is in case the compiler doesn't define _CALL_AIX/etc. result[n++] = *(sp+2); -#elif defined(__linux) +#elif defined(__linux) || defined(__OpenBSD__) // This check is in case the compiler doesn't define _CALL_SYSV. result[n++] = *(sp+1); #else From 2e87f98fe49cfd25ebb045c3eebd4bf2a5956ac4 Mon Sep 17 00:00:00 2001 From: Marco Wang Date: Fri, 8 May 2020 14:50:55 +0800 Subject: [PATCH 14/24] Replace sprintf() with snprintf() (#536) sprintf poses two security risks: (1) write to memory where it shouldn't (2) read from memory where it shouldn't This commit replaces the use of sprintf() with snprintf() which has a size parameter to ensure the problems mentioned above won't take place. --- src/googletest.h | 9 +++++---- src/stl_logging_unittest.cc | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/googletest.h b/src/googletest.h index a9e7795..7230606 100644 --- a/src/googletest.h +++ b/src/googletest.h @@ -448,10 +448,11 @@ static inline string Munge(const string& filename) { string result; while (fgets(buf, 4095, fp)) { string line = MungeLine(buf); - char null_str[256]; - char ptr_str[256]; - sprintf(null_str, "%p", static_cast(NULL)); - sprintf(ptr_str, "%p", reinterpret_cast(PTR_TEST_VALUE)); + const size_t str_size = 256; + char null_str[str_size]; + char ptr_str[str_size]; + snprintf(null_str, str_size, "%p", static_cast(NULL)); + snprintf(ptr_str, str_size, "%p", reinterpret_cast(PTR_TEST_VALUE)); StringReplace(&line, "__NULLP__", null_str); StringReplace(&line, "__PTRTEST__", ptr_str); diff --git a/src/stl_logging_unittest.cc b/src/stl_logging_unittest.cc index 269094c..05acc13 100644 --- a/src/stl_logging_unittest.cc +++ b/src/stl_logging_unittest.cc @@ -135,8 +135,9 @@ static void TestSTLLogging() { for (int i = 0; i < 100; i++) { v.push_back(i); if (i > 0) expected += ' '; - char buf[256]; - sprintf(buf, "%d", i); + const size_t buf_size = 256; + char buf[buf_size]; + snprintf(buf, buf_size, "%d", i); expected += buf; } v.push_back(100); From d8998fe4f638cc0b6a31a00a3d91fc4cfe8ef391 Mon Sep 17 00:00:00 2001 From: huangqinjin Date: Mon, 11 May 2020 22:32:02 +0800 Subject: [PATCH 15/24] Make message text null-terminated --- src/logging.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/logging.cc b/src/logging.cc index ddcf910..be36117 100644 --- a/src/logging.cc +++ b/src/logging.cc @@ -1509,6 +1509,7 @@ void LogMessage::Flush() { original_final_char = data_->message_text_[data_->num_chars_to_log_]; data_->message_text_[data_->num_chars_to_log_++] = '\n'; } + data_->message_text_[data_->num_chars_to_log_] = '\0'; // Prevent any subtle race conditions by wrapping a mutex lock around // the actual logging action per se. From 0a12a96ceef2fc7459a729696fbc0ab716d2a68a Mon Sep 17 00:00:00 2001 From: huangqinjin Date: Mon, 11 May 2020 23:11:52 +0800 Subject: [PATCH 16/24] Output to logcat on Android --- CMakeLists.txt | 4 ++++ src/logging.cc | 26 +++++++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8773af..4cc2e71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -570,6 +570,10 @@ if (gflags_FOUND) endif (NOT BUILD_SHARED_LIBS) endif (gflags_FOUND) +if (ANDROID) + target_link_libraries (glog PUBLIC log) +endif() + set_target_properties (glog PROPERTIES VERSION ${PROJECT_VERSION}) set_target_properties (glog PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR}) diff --git a/src/logging.cc b/src/logging.cc index ddcf910..e091150 100644 --- a/src/logging.cc +++ b/src/logging.cc @@ -73,6 +73,10 @@ # include "stacktrace.h" #endif +#ifdef __ANDROID__ +#include +#endif + using std::string; using std::vector; using std::setw; @@ -500,7 +504,7 @@ class LogDestination { // Take a log message of a particular severity and log it to stderr // iff it's of a high enough severity to deserve it. static void MaybeLogToStderr(LogSeverity severity, const char* message, - size_t len); + size_t message_len, size_t prefix_len); // Take a log message of a particular severity and log it to email // iff it's of a high enough severity to deserve it. @@ -735,12 +739,23 @@ static void WriteToStderr(const char* message, size_t len) { } inline void LogDestination::MaybeLogToStderr(LogSeverity severity, - const char* message, size_t len) { + const char* message, size_t message_len, size_t prefix_len) { if ((severity >= FLAGS_stderrthreshold) || FLAGS_alsologtostderr) { - ColoredWriteToStderr(severity, message, len); + ColoredWriteToStderr(severity, message, message_len); #ifdef OS_WINDOWS // On Windows, also output to the debugger - ::OutputDebugStringA(string(message,len).c_str()); + ::OutputDebugStringA(message); +#elif defined(__ANDROID__) + // On Android, also output to logcat + const int android_log_levels[NUM_SEVERITIES] = { + ANDROID_LOG_INFO, + ANDROID_LOG_WARN, + ANDROID_LOG_ERROR, + ANDROID_LOG_FATAL, + }; + __android_log_write(android_log_levels[severity], + glog_internal_namespace_::ProgramInvocationShortName(), + message + prefix_len); #endif } } @@ -1597,7 +1612,8 @@ void LogMessage::SendToLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) { data_->num_chars_to_log_); LogDestination::MaybeLogToStderr(data_->severity_, data_->message_text_, - data_->num_chars_to_log_); + data_->num_chars_to_log_, + data_->num_prefix_chars_); LogDestination::MaybeLogToEmail(data_->severity_, data_->message_text_, data_->num_chars_to_log_); LogDestination::LogToSinks(data_->severity_, From 0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6 Mon Sep 17 00:00:00 2001 From: Phillipp Schoppmann Date: Tue, 12 May 2020 17:36:55 -0700 Subject: [PATCH 17/24] Fix build for Emscripten (#546) Add back config_setting for WASM (no HAVE_SYSCALL_H) Since there is no config_setting for Linux (https://github.com/bazelbuild/bazel/issues/11107), Linux needs to be the default case. --- bazel/glog.bzl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/bazel/glog.bzl b/bazel/glog.bzl index 1728758..a46e2d1 100644 --- a/bazel/glog.bzl +++ b/bazel/glog.bzl @@ -18,6 +18,12 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs): gendir = "$(GENDIR)" src_windows = "src/windows" + # Config setting for WebAssembly target. + native.config_setting( + name = "wasm", + values = {"cpu": "wasm"}, + ) + common_copts = [ "-DGLOG_BAZEL_BUILD", "-DHAVE_STDINT_H", @@ -25,7 +31,7 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs): "-DHAVE_UNWIND_H", ] + (["-DHAVE_LIB_GFLAGS"] if with_gflags else []) - linux_or_darwin_copts = [ + wasm_copts = [ # Disable warnings that exists in glog. "-Wno-sign-compare", "-Wno-unused-function", @@ -38,7 +44,6 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs): # Allows src/logging.cc to determine the host name. "-DHAVE_SYS_UTSNAME_H", # For src/utilities.cc. - "-DHAVE_SYS_SYSCALL_H", "-DHAVE_SYS_TIME_H", # Enable dumping stacktrace upon sigaction. "-DHAVE_SIGACTION", @@ -48,6 +53,11 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs): "-I%s/glog_internal" % gendir, ] + linux_or_darwin_copts = wasm_copts + [ + # For src/utilities.cc. + "-DHAVE_SYS_SYSCALL_H", + ] + freebsd_only_copts = [ # Enable declaration of _Unwind_Backtrace "-D_GNU_SOURCE", @@ -105,6 +115,7 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs): "@bazel_tools//src/conditions:windows": common_copts + windows_only_copts, "@bazel_tools//src/conditions:darwin": common_copts + linux_or_darwin_copts + darwin_only_copts, "@bazel_tools//src/conditions:freebsd": common_copts + linux_or_darwin_copts + freebsd_only_copts, + ":wasm": common_copts + wasm_copts, "//conditions:default": common_copts + linux_or_darwin_copts, }), deps = [ From 64650ef2ed40e01f3846d22d4f29ea12b129d77f Mon Sep 17 00:00:00 2001 From: Jiuqiang Tang <3359144+jiuqiant@users.noreply.github.com> Date: Fri, 21 Aug 2020 20:24:00 -0700 Subject: [PATCH 18/24] Connect glog to Andorid logging API In LogMessage::Flush(), write to __android_log_write() so that the messages can be seen via "adb logcat". This is already a patch in the Google MediaPipe's repo: https://github.com/google/mediapipe/blob/master/third_party/com_github_glog_glog_9779e5ea6ef59562b030248947f787d1256132ae.diff. --- src/logging.cc | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/logging.cc b/src/logging.cc index ddcf910..5dcdf14 100644 --- a/src/logging.cc +++ b/src/logging.cc @@ -73,6 +73,10 @@ # include "stacktrace.h" #endif +#ifdef __ANDROID__ +#include +#endif + using std::string; using std::vector; using std::setw; @@ -1485,6 +1489,23 @@ ostream& LogMessage::stream() { return data_->stream_; } +namespace { +#if defined(__ANDROID__) +int AndroidLogLevel(const int severity) { + switch (severity) { + case 3: + return ANDROID_LOG_FATAL; + case 2: + return ANDROID_LOG_ERROR; + case 1: + return ANDROID_LOG_WARN; + default: + return ANDROID_LOG_INFO; + } +} +#endif // defined(__ANDROID__) +} // namespace + // Flush buffered message, called by the destructor, or any other function // that needs to synchronize the log. void LogMessage::Flush() { @@ -1518,7 +1539,13 @@ void LogMessage::Flush() { ++num_messages_[static_cast(data_->severity_)]; } LogDestination::WaitForSinks(data_); - + +#if defined(__ANDROID__) + const int level = AndroidLogLevel((int)data_->severity_); + const std::string text = std::string(data_->message_text_); + __android_log_write(level, "native", text.substr(0,data_->num_chars_to_log_).c_str()); +#endif // !defined(__ANDROID__) + if (append_newline) { // Fix the ostrstream back how it was before we screwed with it. // It's 99.44% certain that we don't need to worry about doing this. From 909069ea8237b7261e21c47607fc89a16610a8f9 Mon Sep 17 00:00:00 2001 From: M Samoila Date: Tue, 1 Sep 2020 10:55:53 -0700 Subject: [PATCH 19/24] Add FLAGS_log_utc_time; when 'true' the time will be written in log in UTC --- src/config.h.cmake.in | 3 +++ src/glog/logging.h.in | 3 +++ src/logging.cc | 15 ++++++++++++--- src/windows/glog/logging.h | 3 +++ src/windows/port.cc | 6 ++++++ src/windows/port.h | 4 ++++ 6 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/config.h.cmake.in b/src/config.h.cmake.in index 20f0990..4f014a1 100644 --- a/src/config.h.cmake.in +++ b/src/config.h.cmake.in @@ -142,6 +142,9 @@ /* define if localtime_r is available in time.h */ #cmakedefine HAVE_LOCALTIME_R +/* define if gmtime_r is available in time.h */ +#cmakedefine HAVE_GMTIME_R + /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #cmakedefine LT_OBJDIR diff --git a/src/glog/logging.h.in b/src/glog/logging.h.in index 1e552fc..8e9c0d9 100644 --- a/src/glog/logging.h.in +++ b/src/glog/logging.h.in @@ -380,6 +380,9 @@ DECLARE_int32(max_log_size); // Sets whether to avoid logging to the disk if the disk is full. DECLARE_bool(stop_logging_if_full_disk); +// Use UTC time for logging +DECLARE_bool(log_utc_time); + #ifdef MUST_UNDEF_GFLAGS_DECLARE_MACROS #undef MUST_UNDEF_GFLAGS_DECLARE_MACROS #undef DECLARE_VARIABLE diff --git a/src/logging.cc b/src/logging.cc index ddcf910..6b9e9e0 100644 --- a/src/logging.cc +++ b/src/logging.cc @@ -187,6 +187,9 @@ GLOG_DEFINE_bool(stop_logging_if_full_disk, false, GLOG_DEFINE_string(log_backtrace_at, "", "Emit a backtrace when logging at file:linenum."); +GLOG_DEFINE_bool(log_utc_time, false, + "Use UTC time for logging."); + // TODO(hamaji): consider windows #define PATH_SEPARATOR '/' @@ -1129,7 +1132,10 @@ void LogFileObject::Write(bool force_flush, rollover_attempt_ = 0; struct ::tm tm_time; - localtime_r(×tamp, &tm_time); + if (FLAGS_log_utc_time) + gmtime_r(×tamp, &tm_time); + else + localtime_r(×tamp, &tm_time); // The logfile's filename will have the date/time & pid in it ostringstream time_pid_stream; @@ -1213,7 +1219,7 @@ void LogFileObject::Write(bool force_flush, << ' ' << setw(2) << tm_time.tm_hour << ':' << setw(2) << tm_time.tm_min << ':' - << setw(2) << tm_time.tm_sec << '\n' + << setw(2) << tm_time.tm_sec << (FLAGS_log_utc_time ? " UTC\n" : "\n") << "Running on machine: " << LogDestination::hostname() << '\n' << "Log line format: [IWEF]yyyymmdd hh:mm:ss.uuuuuu " @@ -1418,7 +1424,10 @@ void LogMessage::Init(const char* file, data_->outvec_ = NULL; WallTime now = WallTime_Now(); data_->timestamp_ = static_cast(now); - localtime_r(&data_->timestamp_, &data_->tm_time_); + if(FLAGS_log_utc_time) + gmtime_r(&data_->timestamp_, &data_->tm_time_); + else + localtime_r(&data_->timestamp_, &data_->tm_time_); data_->usecs_ = static_cast((now - data_->timestamp_) * 1000000); data_->num_chars_to_log_ = 0; diff --git a/src/windows/glog/logging.h b/src/windows/glog/logging.h index e111bf0..7710152 100755 --- a/src/windows/glog/logging.h +++ b/src/windows/glog/logging.h @@ -381,6 +381,9 @@ DECLARE_int32(max_log_size); // Sets whether to avoid logging to the disk if the disk is full. DECLARE_bool(stop_logging_if_full_disk); +// Use UTC time for logging. +DECLARE_bool(log_utc_time); + #ifdef MUST_UNDEF_GFLAGS_DECLARE_MACROS #undef MUST_UNDEF_GFLAGS_DECLARE_MACROS #undef DECLARE_VARIABLE diff --git a/src/windows/port.cc b/src/windows/port.cc index 19bda36..3a0c930 100755 --- a/src/windows/port.cc +++ b/src/windows/port.cc @@ -54,6 +54,12 @@ struct tm* localtime_r(const time_t* timep, struct tm* result) { return result; } #endif // not HAVE_LOCALTIME_R +#ifndef HAVE_GMTIME_R +struct tm* gmtime_r(const time_t* timep, struct tm* result) { + gmtime_s(result, timep); + return result; +} +#endif // not HAVE_GMTIME_R #ifndef HAVE_SNPRINTF int snprintf(char *str, size_t size, const char *format, ...) { va_list ap; diff --git a/src/windows/port.h b/src/windows/port.h index 7b4b9c8..75761d4 100755 --- a/src/windows/port.h +++ b/src/windows/port.h @@ -159,6 +159,10 @@ enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock extern GOOGLE_GLOG_DLL_DECL struct tm* localtime_r(const time_t* timep, struct tm* result); #endif // not HAVE_LOCALTIME_R +#ifndef HAVE_GMTIME_R +extern GOOGLE_GLOG_DLL_DECL struct tm* gmtime_r(const time_t* timep, struct tm* result); +#endif // not HAVE_GMTIME_R + inline char* strerror_r(int errnum, char* buf, size_t buflen) { strerror_s(buf, buflen, errnum); return buf; From e5ef2728bd44c528fe8800b0b0326ab69589229d Mon Sep 17 00:00:00 2001 From: Arjun Moudgil Date: Tue, 15 Sep 2020 20:46:35 -0400 Subject: [PATCH 20/24] Added check for if info.dli_sname is NULL Check if info.dli_sname is NULL, If the image containing addr is found, but no nearest symbol was found, the dli_sname and dli_saddr fields are set to NULL. --- src/symbolize.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/symbolize.cc b/src/symbolize.cc index 76a1b0f..7767c90 100644 --- a/src/symbolize.cc +++ b/src/symbolize.cc @@ -857,11 +857,13 @@ static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out, int out_size) { Dl_info info; if (dladdr(pc, &info)) { - if ((int)strlen(info.dli_sname) < out_size) { - strcpy(out, info.dli_sname); - // Symbolization succeeded. Now we try to demangle the symbol. - DemangleInplace(out, out_size); - return true; + if (info.dli_sname) { + if ((int)strlen(info.dli_sname) < out_size) { + strcpy(out, info.dli_sname); + // Symbolization succeeded. Now we try to demangle the symbol. + DemangleInplace(out, out_size); + return true; + } } } return false; From c652590d84ef3e383a13eaabec07adac9e7b4710 Mon Sep 17 00:00:00 2001 From: Yicong Huang Date: Tue, 15 Sep 2020 22:22:13 -0700 Subject: [PATCH 21/24] Update CMakeLists.txt wrap the path with double quotation so that it can build on path with spaces. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8773af..18f1be4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -821,7 +821,7 @@ configure_file (glog-modules.cmake.in install (CODE " set (glog_FULL_CMake_DATADIR \"\\\${CMAKE_CURRENT_LIST_DIR}/${glog_REL_CMake_DATADIR}\") -configure_file (${CMAKE_CURRENT_SOURCE_DIR}/glog-modules.cmake.in +configure_file (\"${CMAKE_CURRENT_SOURCE_DIR}/glog-modules.cmake.in\" \"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/glog-modules.cmake\" @ONLY) file (INSTALL \"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/glog-modules.cmake\" From 725818984761d85e69a24a7d7864d9f046811e34 Mon Sep 17 00:00:00 2001 From: Santiago Gil Date: Thu, 24 Sep 2020 10:48:00 +0100 Subject: [PATCH 22/24] Add `override` to `LogStreamBuf::overflow()` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevents warnings such as: ``` glog/logging.h:1122:20: error: ‘virtual std::basic_streambuf::int_type google::base_logging::LogStreamBuf::overflow(std::basic_streambuf::int_type)’ can be marked override [-Werror=suggest-override] virtual int_type overflow(int_type ch) { ^~~~~~~~ ``` Signed-off-by: Santiago Gil --- src/glog/logging.h.in | 2 +- src/windows/glog/logging.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/glog/logging.h.in b/src/glog/logging.h.in index 1e552fc..8901b9c 100644 --- a/src/glog/logging.h.in +++ b/src/glog/logging.h.in @@ -1128,7 +1128,7 @@ class GOOGLE_GLOG_DLL_DECL LogStreamBuf : public std::streambuf { } // This effectively ignores overflow. - virtual int_type overflow(int_type ch) { + int_type overflow(int_type ch) { return ch; } diff --git a/src/windows/glog/logging.h b/src/windows/glog/logging.h index e111bf0..f42d936 100755 --- a/src/windows/glog/logging.h +++ b/src/windows/glog/logging.h @@ -1129,7 +1129,7 @@ class GOOGLE_GLOG_DLL_DECL LogStreamBuf : public std::streambuf { } // This effectively ignores overflow. - virtual int_type overflow(int_type ch) { + int_type overflow(int_type ch) { return ch; } From 6c0a5fcb53bff882fef058505f52a4458ce505ad Mon Sep 17 00:00:00 2001 From: Victor Costan Date: Fri, 10 Apr 2020 19:49:53 -0700 Subject: [PATCH 23/24] Fix unused parameter warning on gcc. --- src/glog/logging.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/glog/logging.h.in b/src/glog/logging.h.in index da5dd19..bac5735 100644 --- a/src/glog/logging.h.in +++ b/src/glog/logging.h.in @@ -1438,7 +1438,7 @@ class GOOGLE_GLOG_DLL_DECL LogSink { virtual void send(LogSeverity severity, const char* full_filename, const char* base_filename, int line, const struct ::tm* tm_time, - const char* message, size_t message_len, int32 usecs) { + const char* message, size_t message_len, int32 /*usecs*/) { send(severity, full_filename, base_filename, line, tm_time, message, message_len); } From b539557b3692c9c68d4e91d3cc920e8d14490d46 Mon Sep 17 00:00:00 2001 From: Sergiu Deitsch Date: Thu, 1 Oct 2020 11:39:04 +0200 Subject: [PATCH 24/24] removed autoconf support --- CONTRIBUTING.md | 58 -- INSTALL | 313 --------- Makefile.am | 259 -------- README.md | 10 - README.rst | 800 ++++++++++++++++++++++++ autogen.sh | 5 - cmake/INSTALL.md | 81 --- configure.ac | 246 -------- doc/designstyle.css | 115 ---- doc/glog.html | 631 ------------------- m4/ac_have_attribute.m4 | 16 - m4/ac_have_builtin_expect.m4 | 14 - m4/ac_have_sync_val_compare_and_swap.m4 | 14 - m4/ac_rwlock.m4 | 31 - m4/acx_pthread.m4 | 363 ----------- m4/google_namespace.m4 | 36 -- m4/ltsugar.m4 | 123 ---- m4/lt~obsolete.m4 | 98 --- m4/namespaces.m4 | 15 - m4/pc_from_ucontext.m4 | 71 --- m4/stl_namespace.m4 | 25 - m4/using_operator.m4 | 15 - packages/deb.sh | 73 --- packages/deb/README | 7 - packages/deb/changelog | 71 --- packages/deb/compat | 1 - packages/deb/control | 23 - packages/deb/copyright | 35 -- packages/deb/docs | 7 - packages/deb/libgoogle-glog-dev.dirs | 4 - packages/deb/libgoogle-glog-dev.install | 10 - packages/deb/libgoogle-glog0.dirs | 1 - packages/deb/libgoogle-glog0.install | 2 - packages/deb/rules | 117 ---- packages/rpm.sh | 75 --- packages/rpm/rpm.spec | 72 --- 36 files changed, 800 insertions(+), 3037 deletions(-) delete mode 100644 CONTRIBUTING.md delete mode 100644 INSTALL delete mode 100644 Makefile.am delete mode 100644 README.md create mode 100644 README.rst delete mode 100755 autogen.sh delete mode 100644 cmake/INSTALL.md delete mode 100644 configure.ac delete mode 100644 doc/designstyle.css delete mode 100644 doc/glog.html delete mode 100644 m4/ac_have_attribute.m4 delete mode 100644 m4/ac_have_builtin_expect.m4 delete mode 100644 m4/ac_have_sync_val_compare_and_swap.m4 delete mode 100644 m4/ac_rwlock.m4 delete mode 100644 m4/acx_pthread.m4 delete mode 100644 m4/google_namespace.m4 delete mode 100644 m4/ltsugar.m4 delete mode 100644 m4/lt~obsolete.m4 delete mode 100644 m4/namespaces.m4 delete mode 100644 m4/pc_from_ucontext.m4 delete mode 100644 m4/stl_namespace.m4 delete mode 100644 m4/using_operator.m4 delete mode 100755 packages/deb.sh delete mode 100644 packages/deb/README delete mode 100644 packages/deb/changelog delete mode 100644 packages/deb/compat delete mode 100644 packages/deb/control delete mode 100644 packages/deb/copyright delete mode 100644 packages/deb/docs delete mode 100644 packages/deb/libgoogle-glog-dev.dirs delete mode 100644 packages/deb/libgoogle-glog-dev.install delete mode 100644 packages/deb/libgoogle-glog0.dirs delete mode 100644 packages/deb/libgoogle-glog0.install delete mode 100755 packages/deb/rules delete mode 100755 packages/rpm.sh delete mode 100644 packages/rpm/rpm.spec diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 43de4c9..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,58 +0,0 @@ -# How to contribute # - -We'd love to accept your patches and contributions to this project. There are -a just a few small guidelines you need to follow. - - -## Contributor License Agreement ## - -Contributions to any Google project must be accompanied by a Contributor -License Agreement. This is not a copyright **assignment**, it simply gives -Google permission to use and redistribute your contributions as part of the -project. - - * If you are an individual writing original source code and you're sure you - own the intellectual property, then you'll need to sign an [individual - CLA][]. - - * If you work for a company that wants to allow you to contribute your work, - then you'll need to sign a [corporate CLA][]. - -You generally only need to submit a CLA once, so if you've already submitted -one (even if it was for a different project), you probably don't need to do it -again. - -[individual CLA]: https://developers.google.com/open-source/cla/individual -[corporate CLA]: https://developers.google.com/open-source/cla/corporate - -Once your CLA is submitted (or if you already submitted one for -another Google project), make a commit adding yourself to the -[AUTHORS][] and [CONTRIBUTORS][] files. This commit can be part -of your first [pull request][]. - -[AUTHORS]: AUTHORS -[CONTRIBUTORS]: CONTRIBUTORS - - -## Submitting a patch ## - - 1. It's generally best to start by opening a new issue describing the bug or - feature you're intending to fix. Even if you think it's relatively minor, - it's helpful to know what people are working on. Mention in the initial - issue that you are planning to work on that bug or feature so that it can - be assigned to you. - - 1. Follow the normal process of [forking][] the project, and setup a new - branch to work in. It's important that each group of changes be done in - separate branches in order to ensure that a pull request only includes the - commits related to that bug or feature. - - 1. Do your best to have [well-formed commit messages][] for each change. - This provides consistency throughout the project, and ensures that commit - messages are able to be formatted properly by various git tools. - - 1. Finally, push the commits to your fork and submit a [pull request][]. - -[forking]: https://help.github.com/articles/fork-a-repo -[well-formed commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html -[pull request]: https://help.github.com/articles/creating-a-pull-request diff --git a/INSTALL b/INSTALL deleted file mode 100644 index e9530ac..0000000 --- a/INSTALL +++ /dev/null @@ -1,313 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, -2006, 2007 Free Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Glog-Specific Install Notes -================================ - -*** NOTE FOR 64-BIT LINUX SYSTEMS - -The glibc built-in stack-unwinder on 64-bit systems has some problems -with the glog libraries. (In particular, if you are using -InstallFailureSignalHandler(), the signal may be raised in the middle -of malloc, holding some malloc-related locks when they invoke the -stack unwinder. The built-in stack unwinder may call malloc -recursively, which may require the thread to acquire a lock it already -holds: deadlock.) - -For that reason, if you use a 64-bit system and you need -InstallFailureSignalHandler(), we strongly recommend you install -libunwind before trying to configure or install google glog. -libunwind can be found at - - http://download.savannah.nongnu.org/releases/libunwind/libunwind-snap-070410.tar.gz - -Even if you already have libunwind installed, you will probably still -need to install from the snapshot to get the latest version. - -CAUTION: if you install libunwind from the URL above, be aware that -you may have trouble if you try to statically link your binary with -glog: that is, if you link with 'gcc -static -lgcc_eh ...'. This -is because both libunwind and libgcc implement the same C++ exception -handling APIs, but they implement them differently on some platforms. -This is not likely to be a problem on ia64, but may be on x86-64. - -Also, if you link binaries statically, make sure that you add --Wl,--eh-frame-hdr to your linker options. This is required so that -libunwind can find the information generated by the compiler required -for stack unwinding. - -Using -static is rare, though, so unless you know this will affect you -it probably won't. - -If you cannot or do not wish to install libunwind, you can still try -to use two kinds of stack-unwinder: 1. glibc built-in stack-unwinder -and 2. frame pointer based stack-unwinder. - -1. As we already mentioned, glibc's unwinder has a deadlock issue. -However, if you don't use InstallFailureSignalHandler() or you don't -worry about the rare possibilities of deadlocks, you can use this -stack-unwinder. If you specify no options and libunwind isn't -detected on your system, the configure script chooses this unwinder by -default. - -2. The frame pointer based stack unwinder requires that your -application, the glog library, and system libraries like libc, all be -compiled with a frame pointer. This is *not* the default for x86-64. - -If you are on x86-64 system, know that you have a set of system -libraries with frame-pointers enabled, and compile all your -applications with -fno-omit-frame-pointer, then you can enable the -frame pointer based stack unwinder by passing the ---enable-frame-pointers flag to configure. - - -Basic Installation -================== - -Briefly, the shell commands `./configure; make; make install' should -configure, build, and install this package. The following -more-detailed instructions are generic; see the `README.md' file for -instructions specific to this package. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. Caching is -disabled by default to prevent problems with accidental use of stale -cache files. - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README.md' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You need `configure.ac' if -you want to change it or regenerate `configure' using a newer version -of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. - - Running `configure' might take a while. While running, it prints - some messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - - 6. Often, you can also type `make uninstall' to remove the installed - files again. - - -Building glog - Using vcpkg -=========================== - -The url of vcpkg is: https://github.com/Microsoft/vcpkg -You can download and install glog using the vcpkg dependency manager: - - git clone https://github.com/Microsoft/vcpkg.git - cd vcpkg - ./bootstrap-vcpkg.sh - ./vcpkg integrate install - ./vcpkg install glog - -The glog port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository. - - -Compilers and Options -===================== - -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c99 CFLAGS=-g LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - -You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - With a non-GNU `make', it is safer to compile the package for one -architecture at a time in the source code directory. After you have -installed the package for one architecture, use `make distclean' before -reconfiguring for another architecture. - -Installation Names -================== - -By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - -Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README.md' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - -Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). - -Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf bug. Until the bug is fixed you can use this workaround: - - CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash - -`configure' Invocation -====================== - -`configure' recognizes the following options to control how it operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index e792332..0000000 --- a/Makefile.am +++ /dev/null @@ -1,259 +0,0 @@ -## Process this file with automake to produce Makefile.in - -AUTOMAKE_OPTIONS = subdir-objects foreign - -# Make sure that when we re-make ./configure, we get the macros we need -ACLOCAL_AMFLAGS = -I m4 - -# This is so we can #include -AM_CPPFLAGS = -I$(top_srcdir)/src - -# This is mostly based on configure options -AM_CXXFLAGS = - -# These are good warnings to turn on by default -if GCC - AM_CXXFLAGS += -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -endif - -# These are x86-specific, having to do with frame-pointers -if X86_64 -if ENABLE_FRAME_POINTERS - AM_CXXFLAGS += -fno-omit-frame-pointer -else - # TODO(csilvers): check if -fomit-frame-pointer might be in $(CXXFLAGS), - # before setting this. - AM_CXXFLAGS += -DNO_FRAME_POINTER -endif -endif - -if DISABLE_RTTI - AM_CXXFLAGS += -fno-rtti -endif - -glogincludedir = $(includedir)/glog -## The .h files you want to install (that is, .h files that people -## who install this package can include in their own applications.) -## We have to include both the .h and .h.in forms. The latter we -## put in noinst_HEADERS. -gloginclude_HEADERS = src/glog/log_severity.h -nodist_gloginclude_HEADERS = src/glog/logging.h src/glog/raw_logging.h src/glog/vlog_is_on.h src/glog/stl_logging.h -noinst_HEADERS = src/glog/logging.h.in src/glog/raw_logging.h.in src/glog/vlog_is_on.h.in src/glog/stl_logging.h.in - -## This is for HTML and other documentation you want to install. -## Add your documentation files (in doc/) in addition to these -## top-level boilerplate files. Also add a TODO file if you have one. -dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL README.md README.windows \ - doc/designstyle.css doc/glog.html - -## The libraries (.so's) you want to install -lib_LTLIBRARIES = - -# The libraries libglog depends on. -COMMON_LIBS = $(PTHREAD_LIBS) $(GFLAGS_LIBS) $(UNWIND_LIBS) -# Compile switches for our unittest. -TEST_CFLAGS = $(GTEST_CFLAGS) $(GMOCK_CFLAGS) $(GFLAGS_CFLAGS) \ - $(MINGW_CFLAGS) $(AM_CXXFLAGS) -# Libraries for our unittest. -TEST_LIBS = $(GTEST_LIBS) $(GMOCK_LIBS) $(GFLAGS_LIBS) - -## unittests you want to run when people type 'make check'. -## TESTS is for binary unittests, check_SCRIPTS for script-based unittests. -## TESTS_ENVIRONMENT sets environment variables for when you run unittest, -## but it only seems to take effect for *binary* unittests (argh!) -TESTS = -# Set a small stack size so that (at least on Linux) PIEs are mapped at a lower -# address than DSOs. This is used by symbolize_pie_unittest to check that we can -# successfully symbolize PIEs loaded at low addresses. -TESTS_ENVIRONMENT = ulimit -s 8192; -check_SCRIPTS = -# Every time you add a unittest to check_SCRIPTS, add it here too -noinst_SCRIPTS = -# Binaries used for script-based unittests. -TEST_BINARIES = - -TESTS += logging_unittest -logging_unittest_SOURCES = $(gloginclude_HEADERS) \ - src/logging_unittest.cc \ - src/config_for_unittests.h \ - src/mock-log.h -nodist_logging_unittest_SOURCES = $(nodist_gloginclude_HEADERS) -logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS) -logging_unittest_LDFLAGS = $(PTHREAD_CFLAGS) -logging_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS) - -check_SCRIPTS += logging_striplog_test_sh -noinst_SCRIPTS += src/logging_striplog_test.sh -logging_striplog_test_sh: logging_striptest0 logging_striptest2 logging_striptest10 - $(top_srcdir)/src/logging_striplog_test.sh - -check_SCRIPTS += demangle_unittest_sh -noinst_SCRIPTS += src/demangle_unittest.sh -demangle_unittest_sh: demangle_unittest - $(builddir)/demangle_unittest # force to create lt-demangle_unittest - $(top_srcdir)/src/demangle_unittest.sh - -check_SCRIPTS += signalhandler_unittest_sh -noinst_SCRIPTS += src/signalhandler_unittest.sh -signalhandler_unittest_sh: signalhandler_unittest - $(builddir)/signalhandler_unittest # force to create lt-signalhandler_unittest - $(top_srcdir)/src/signalhandler_unittest.sh - -TEST_BINARIES += logging_striptest0 -logging_striptest0_SOURCES = $(gloginclude_HEADERS) \ - src/logging_striptest_main.cc -nodist_logging_striptest0_SOURCES = $(nodist_gloginclude_HEADERS) -logging_striptest0_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS) -logging_striptest0_LDFLAGS = $(PTHREAD_CFLAGS) -logging_striptest0_LDADD = libglog.la $(COMMON_LIBS) - -TEST_BINARIES += logging_striptest2 -logging_striptest2_SOURCES = $(gloginclude_HEADERS) \ - src/logging_striptest2.cc -nodist_logging_striptest2_SOURCES = $(nodist_gloginclude_HEADERS) -logging_striptest2_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS) -logging_striptest2_LDFLAGS = $(PTHREAD_CFLAGS) -logging_striptest2_LDADD = libglog.la $(COMMON_LIBS) - -TEST_BINARIES += logging_striptest10 -logging_striptest10_SOURCES = $(gloginclude_HEADERS) \ - src/logging_striptest10.cc -nodist_logging_striptest10_SOURCES = $(nodist_gloginclude_HEADERS) -logging_striptest10_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS) -logging_striptest10_LDFLAGS = $(PTHREAD_CFLAGS) -logging_striptest10_LDADD = libglog.la $(COMMON_LIBS) - -TESTS += demangle_unittest -demangle_unittest_SOURCES = $(gloginclude_HEADERS) \ - src/demangle_unittest.cc -nodist_demangle_unittest_SOURCES = $(nodist_gloginclude_HEADERS) -demangle_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS) -demangle_unittest_LDFLAGS = $(PTHREAD_CFLAGS) -demangle_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS) - -TESTS += stacktrace_unittest -stacktrace_unittest_SOURCES = $(gloginclude_HEADERS) \ - src/stacktrace_unittest.cc -nodist_stacktrace_unittest_SOURCES = $(nodist_gloginclude_HEADERS) -stacktrace_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS) -stacktrace_unittest_LDFLAGS = $(PTHREAD_CFLAGS) -stacktrace_unittest_LDADD = libglog.la $(COMMON_LIBS) - -TESTS += symbolize_unittest -symbolize_unittest_SOURCES = $(gloginclude_HEADERS) \ - src/symbolize_unittest.cc -nodist_symbolize_unittest_SOURCES = $(nodist_gloginclude_HEADERS) -symbolize_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS) -symbolize_unittest_LDFLAGS = $(PTHREAD_CFLAGS) -symbolize_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS) - -TESTS += symbolize_pie_unittest -symbolize_pie_unittest_SOURCES = $(gloginclude_HEADERS) \ - src/symbolize_unittest.cc -nodist_symbolize_pie_unittest_SOURCES = $(nodist_gloginclude_HEADERS) -symbolize_pie_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS) -fPIE -symbolize_pie_unittest_LDFLAGS = $(PTHREAD_CFLAGS) -pie -symbolize_pie_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS) - -TESTS += stl_logging_unittest -stl_logging_unittest_SOURCES = $(gloginclude_HEADERS) \ - src/stl_logging_unittest.cc -nodist_stl_logging_unittest_SOURCES = $(nodist_gloginclude_HEADERS) -stl_logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS) -stl_logging_unittest_LDFLAGS = $(PTHREAD_CFLAGS) -stl_logging_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS) - -TEST_BINARIES += signalhandler_unittest -signalhandler_unittest_SOURCES = $(gloginclude_HEADERS) \ - src/signalhandler_unittest.cc -nodist_signalhandler_unittest_SOURCES = $(nodist_gloginclude_HEADERS) -signalhandler_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS) -signalhandler_unittest_LDFLAGS = $(PTHREAD_CFLAGS) -signalhandler_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS) - -TESTS += utilities_unittest -utilities_unittest_SOURCES = $(gloginclude_HEADERS) \ - src/utilities_unittest.cc -nodist_utilities_unittest_SOURCES = $(nodist_gloginclude_HEADERS) -utilities_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS) -utilities_unittest_LDFLAGS = $(PTHREAD_CFLAGS) -utilities_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS) - -if HAVE_GMOCK -TESTS += mock_log_test -mock_log_test_SOURCES = $(gloginclude_HEADERS) \ - src/mock-log_test.cc -nodist_mock_log_test_SOURCES = $(nodist_gloginclude_HEADERS) -mock_log_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(TEST_CFLAGS) -mock_log_test_LDFLAGS = $(PTHREAD_CFLAGS) -mock_log_test_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS) -endif - -## vvvv RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS - -lib_LTLIBRARIES += libglog.la -libglog_la_SOURCES = $(gloginclude_HEADERS) \ - src/logging.cc src/raw_logging.cc src/vlog_is_on.cc \ - src/utilities.cc src/utilities.h \ - src/demangle.cc src/demangle.h \ - src/stacktrace.h \ - src/stacktrace_generic-inl.h \ - src/stacktrace_libunwind-inl.h \ - src/stacktrace_powerpc-inl.h \ - src/stacktrace_x86-inl.h \ - src/stacktrace_x86_64-inl.h \ - src/symbolize.cc src/symbolize.h \ - src/signalhandler.cc \ - src/base/mutex.h src/base/googleinit.h \ - src/base/commandlineflags.h src/googletest.h -nodist_libglog_la_SOURCES = $(nodist_gloginclude_HEADERS) - -libglog_la_CXXFLAGS = $(PTHREAD_CFLAGS) $(GFLAGS_CFLAGS) $(MINGW_CFLAGS) \ - $(AM_CXXFLAGS) -DNDEBUG -libglog_la_LDFLAGS = $(PTHREAD_CFLAGS) $(GFLAGS_LDFLAGS) -libglog_la_LIBADD = $(COMMON_LIBS) - -## The location of the windows project file for each binary we make -WINDOWS_PROJECTS = google-glog.sln -WINDOWS_PROJECTS += vsprojects/libglog/libglog.vcproj -WINDOWS_PROJECTS += vsprojects/logging_unittest/logging_unittest.vcproj -WINDOWS_PROJECTS += vsprojects/libglog_static/libglog_static.vcproj -WINDOWS_PROJECTS += vsprojects/logging_unittest_static/logging_unittest_static.vcproj - -## ^^^^ END OF RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS - - -## This should always include $(TESTS), but may also include other -## binaries that you compile but don't want automatically installed. -noinst_PROGRAMS = $(TESTS) $(TEST_BINARIES) - -rpm: dist-gzip packages/rpm.sh packages/rpm/rpm.spec - @cd packages && ./rpm.sh ${PACKAGE} ${VERSION} - -deb: dist-gzip packages/deb.sh packages/deb/* - @cd packages && ./deb.sh ${PACKAGE} ${VERSION} - -# Windows wants write permission to .vcproj files and maybe even sln files. -dist-hook: - test -e "$(distdir)/vsprojects" \ - && chmod -R u+w $(distdir)/*.sln $(distdir)/vsprojects/ - -libtool: $(LIBTOOL_DEPS) - $(SHELL) ./config.status --recheck - -EXTRA_DIST = packages/rpm.sh packages/rpm/rpm.spec \ - packages/deb.sh packages/deb/* \ - $(SCRIPTS) src/logging_unittest.err src/demangle_unittest.txt \ - src/windows/config.h src/windows/port.h src/windows/port.cc \ - src/windows/preprocess.sh \ - src/windows/glog/log_severity.h src/windows/glog/logging.h \ - src/windows/glog/raw_logging.h src/windows/glog/stl_logging.h \ - src/windows/glog/vlog_is_on.h \ - $(WINDOWS_PROJECTS) - -CLEANFILES = core demangle.dm demangle.nm signalhandler.out* \ - signalhandler_unittest.*.log.INFO.* - -# Add pkgconfig file -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libglog.pc diff --git a/README.md b/README.md deleted file mode 100644 index 965766c..0000000 --- a/README.md +++ /dev/null @@ -1,10 +0,0 @@ -[![Build Status](https://img.shields.io/travis/google/glog/master.svg?label=Travis)](https://travis-ci.org/google/glog/builds) -[![Grunt status](https://img.shields.io/appveyor/ci/google-admin/glog/master.svg?label=Appveyor)](https://ci.appveyor.com/project/google-admin/glog/history) - -This repository contains a C++ implementation of the Google logging -module. Documentation for the implementation is in doc/. - -See INSTALL for (generic) installation instructions for C++: basically -```sh -./autogen.sh && ./configure && make && make install -``` diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..a7c5929 --- /dev/null +++ b/README.rst @@ -0,0 +1,800 @@ +Google Logging Library +====================== + +|Build Status| |Grunt status| + +The Google Logging Library (glog) implements application-level logging. +The library provides logging APIs based on C++-style streams and various +helper macros. + +Getting Started +--------------- + +You can log a message by simply streaming things to ``LOG``\ (`__>), e.g., + +.. code:: cpp + + #include + + int main(int argc, char* argv[]) { + // Initialize Google’s logging library. + google::InitGoogleLogging(argv[0]); + + // ... + LOG(INFO) << "Found " << num_cookies << " cookies"; + } + + +For a detailed overview of glog features and their usage, please refer +to the `user guide <#user-guide>`__. + +.. contents:: Table of Contents + + +Building from Source +-------------------- + +glog supports multiple build systems for compiling the project from +source: `Bazel <#bazel>`__, `CMake <#cmake>`__, and `vcpkg <#vcpkg>`__. + +Bazel +~~~~~ + +To use glog within a project which uses the +`Bazel `__ build tool, add the following lines to +your ``WORKSPACE`` file: + +.. code:: starlark + + load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + + http_archive( + name = "com_github_gflags_gflags", + sha256 = "34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf", + strip_prefix = "gflags-2.2.2", + urls = ["https://github.com/gflags/gflags/archive/v2.2.2.tar.gz"], + ) + + http_archive( + name = "com_github_google_glog", + sha256 = "62efeb57ff70db9ea2129a16d0f908941e355d09d6d83c9f7b18557c0a7ab59e", + strip_prefix = "glog-d516278b1cd33cd148e8989aec488b6049a4ca0b", + urls = ["https://github.com/google/glog/archive/d516278b1cd33cd148e8989aec488b6049a4ca0b.zip"], + ) + +You can then add ``@com_github_google_glog//:glog`` to the deps section of a +``cc_binary`` or ``cc_library`` rule, and ``#include `` to +include it in your source code. Here’s a simple example: + +.. code:: starlark + + cc_binary( + name = "main", + srcs = ["main.cc"], + deps = ["@com_github_google_glog//:glog"], + ) + +CMake +~~~~~ + +glog also supports CMake that can be used to build the project on a wide +range of platforms. If you don’t have CMake installed already, you can +download it for from CMake’s `official +website `__. + +CMake works by generating native makefiles or build projects that can be +used in the compiler environment of your choice. You can either build +glog with CMake as a standalone project or it can be incorporated into +an existing CMake build for another project. + +Building glog with CMake +^^^^^^^^^^^^^^^^^^^^^^^^ + +When building glog as a standalone project, on Unix-like systems with +GNU Make as build tool, the typical workflow is: + +1. Get the source code and change to it. e.g., cloning with git: + + .. code:: bash + + git clone git@github.com:google/glog.git + cd glog + +2. Run CMake to configure the build tree. + + .. code:: bash + + cmake -H. -Bbuild -G "Unix Makefiles" + + Note: to get the list of available generators (e.g., Visual Studio), use ``-G ""`` + +3. Afterwards, generated files can be used to compile the project. + + .. code:: bash + + cmake --build build + +4. Test the build software (optional). + + .. code:: bash + + cmake --build build --target test + +5. Install the built files (optional). + + .. code:: bash + + cmake --build build --target install + +Consuming glog in a CMake Project +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If you have glog installed in your system, you can use the CMake command +``find_package`` to build against glog in your CMake Project as follows: + +.. code:: cmake + + cmake_minimum_required (VERSION 3.0.2) + project (myproj VERSION 1.0) + + find_package (glog 0.4.0 REQUIRED) + + add_executable (myapp main.cpp) + target_link_libraries (myapp glog::glog) + +Compile definitions and options will be added automatically to your +target as needed. + +Incorporating glog into a CMake Project +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +You can also use the CMake command ``add_subdirectory`` to include glog +directly from a subdirectory of your project by replacing the +``find_package`` call from the previous example by ``add_subdirectory``. +The ``glog::glog`` target is in this case an ``ALIAS`` library target +for the ``glog`` library target. + +Again, compile definitions and options will be added automatically to +your target as needed. + +vcpkg +~~~~~ + +The url of vcpkg is: https://github.com/Microsoft/vcpkg You can download +and install glog using the vcpkg dependency manager: + +.. code:: bash + + git clone https://github.com/Microsoft/vcpkg.git + cd vcpkg + ./bootstrap-vcpkg.sh + ./vcpkg integrate install + ./vcpkg install glog + +The glog port in vcpkg is kept up to date by Microsoft team members and +community contributors. If the version is out of date, please create an +issue or pull request on the vcpkg repository. + +User Guide +---------- + +glog defines a series of macros that simplify many common logging tasks. +You can log messages by severity level, control logging behavior from +the command line, log based on conditionals, abort the program when +expected conditions are not met, introduce your own verbose logging +levels, and more. + +Following sections describe the functionality supported by glog. Please +note this description may not be complete but limited to the most useful +ones. If you want to find less common features, please check header +files under ``src/glog`` directory. + +Severity Levels +~~~~~~~~~~~~~~~ + +You can specify one of the following severity levels (in increasing +order of severity): ``INFO``, ``WARNING``, ``ERROR``, and ``FATAL``. +Logging a ``FATAL`` message terminates the program (after the message is +logged). Note that messages of a given severity are logged not only in +the logfile for that severity, but also in all logfiles of lower +severity. E.g., a message of severity ``FATAL`` will be logged to the +logfiles of severity ``FATAL``, ``ERROR``, ``WARNING``, and ``INFO``. + +The ``DFATAL`` severity logs a ``FATAL`` error in debug mode (i.e., +there is no ``NDEBUG`` macro defined), but avoids halting the program in +production by automatically reducing the severity to ``ERROR``. + +Unless otherwise specified, glog writes to the filename +``/tmp/\.\.\.log.\.\.\.\`` +(e.g., +``/tmp/hello_world.example.com.hamaji.log.INFO.20080709-222411.10474``). +By default, glog copies the log messages of severity level ``ERROR`` or +``FATAL`` to standard error (``stderr``) in addition to log files. + +Setting Flags +~~~~~~~~~~~~~ + +Several flags influence glog’s output behavior. If the `Google gflags +library `__ is installed on your +machine, the ``configure`` script (see the INSTALL file in the package +for detail of this script) will automatically detect and use it, +allowing you to pass flags on the command line. For example, if you want +to turn the flag ``--logtostderr`` on, you can start your application +with the following command line: + +.. code:: bash + + ./your_application --logtostderr=1 + +If the Google gflags library isn’t installed, you set flags via +environment variables, prefixing the flag name with ``GLOG_``, e.g., + +.. code:: bash + + GLOG_logtostderr=1 ./your_application + +The following flags are most commonly used: + +``logtostderr`` (``bool``, default=\ ``false``) + Log messages to ``stderr`` instead of logfiles. Note: you can set + binary flags to ``true`` by specifying ``1``, ``true``, or ``yes`` + (case insensitive). Also, you can set binary flags to ``false`` by + specifying ``0``, ``false``, or ``no`` (again, case insensitive). + +``stderrthreshold`` (``int``, default=2, which is ``ERROR``) + Copy log messages at or above this level to stderr in addition to + logfiles. The numbers of severity levels ``INFO``, ``WARNING``, + ``ERROR``, and ``FATAL`` are 0, 1, 2, and 3, respectively. + +``minloglevel`` (``int``, default=0, which is ``INFO``) + Log messages at or above this level. Again, the numbers of severity + levels ``INFO``, ``WARNING``, ``ERROR``, and ``FATAL`` are 0, 1, 2, + and 3, respectively. + +``log_dir`` (``string``, default="") + If specified, logfiles are written into this directory instead of the + default logging directory. + +``v`` (``int``, default=0) + Show all ``VLOG(m)`` messages for ``m`` less or equal the value of + this flag. Overridable by ``--vmodule``. See `the section about + verbose logging <#verbose>`__ for more detail. + +``vmodule`` (``string``, default="") + Per-module verbose level. The argument has to contain a + comma-separated list of =. is a + glob pattern (e.g., ``gfs*`` for all modules whose name starts with + "gfs"), matched against the filename base (that is, name ignoring + .cc/.h./-inl.h). overrides any value given by ``--v``. + See also `the section about verbose logging <#verbose>`__. + +There are some other flags defined in logging.cc. Please grep the source +code for ``DEFINE_`` to see a complete list of all flags. + +You can also modify flag values in your program by modifying global +variables ``FLAGS_*`` . Most settings start working immediately after +you update ``FLAGS_*`` . The exceptions are the flags related to +destination files. For example, you might want to set ``FLAGS_log_dir`` +before calling ``google::InitGoogleLogging`` . Here is an example: + +.. code:: cpp + + LOG(INFO) << "file"; + // Most flags work immediately after updating values. + FLAGS_logtostderr = 1; + LOG(INFO) << "stderr"; + FLAGS_logtostderr = 0; + // This won’t change the log destination. If you want to set this + // value, you should do this before google::InitGoogleLogging . + FLAGS_log_dir = "/some/log/directory"; + LOG(INFO) << "the same file"; + +Conditional / Occasional Logging +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Sometimes, you may only want to log a message under certain conditions. +You can use the following macros to perform conditional logging: + +.. code:: cpp + + LOG_IF(INFO, num_cookies > 10) << "Got lots of cookies"; + +The "Got lots of cookies" message is logged only when the variable +``num_cookies`` exceeds 10. If a line of code is executed many times, it +may be useful to only log a message at certain intervals. This kind of +logging is most useful for informational messages. + +.. code:: cpp + + LOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie"; + +The above line outputs a log messages on the 1st, 11th, 21st, ... times +it is executed. Note that the special ``google::COUNTER`` value is used +to identify which repetition is happening. + +You can combine conditional and occasional logging with the following +macro. + +.. code:: cpp + + LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << google::COUNTER + << "th big cookie"; + +Instead of outputting a message every nth time, you can also limit the +output to the first n occurrences: + +.. code:: cpp + + LOG_FIRST_N(INFO, 20) << "Got the " << google::COUNTER << "th cookie"; + +Outputs log messages for the first 20 times it is executed. Again, the +``google::COUNTER`` identifier indicates which repetition is happening. + +Debug Mode Support +~~~~~~~~~~~~~~~~~~ + +Special "debug mode" logging macros only have an effect in debug mode +and are compiled away to nothing for non-debug mode compiles. Use these +macros to avoid slowing down your production application due to +excessive logging. + +.. code:: cpp + + DLOG(INFO) << "Found cookies"; + DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies"; + DLOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie"; + + +``CHECK`` Macros +~~~~~~~~~~~~~~~~ + +It is a good practice to check expected conditions in your program +frequently to detect errors as early as possible. The ``CHECK`` macro +provides the ability to abort the application when a condition is not +met, similar to the ``assert`` macro defined in the standard C library. + +``CHECK`` aborts the application if a condition is not true. Unlike +``assert``, it is \*not\* controlled by ``NDEBUG``, so the check will be +executed regardless of compilation mode. Therefore, ``fp->Write(x)`` in +the following example is always executed: + +.. code:: cpp + + CHECK(fp->Write(x) == 4) << "Write failed!"; + +There are various helper macros for equality/inequality checks - +``CHECK_EQ``, ``CHECK_NE``, ``CHECK_LE``, ``CHECK_LT``, ``CHECK_GE``, +and ``CHECK_GT``. They compare two values, and log a ``FATAL`` message +including the two values when the result is not as expected. The values +must have ``operator<<(ostream, ...)`` defined. + +You may append to the error message like so: + +.. code:: cpp + + CHECK_NE(1, 2) << ": The world must be ending!"; + +We are very careful to ensure that each argument is evaluated exactly +once, and that anything which is legal to pass as a function argument is +legal here. In particular, the arguments may be temporary expressions +which will end up being destroyed at the end of the apparent statement, +for example: + +.. code:: cpp + + CHECK_EQ(string("abc")[1], ’b’); + +The compiler reports an error if one of the arguments is a pointer and +the other is ``NULL``. To work around this, simply ``static_cast`` +``NULL`` to the type of the desired pointer. + +.. code:: cpp + + CHECK_EQ(some_ptr, static_cast(NULL)); + +Better yet, use the ``CHECK_NOTNULL`` macro: + +.. code:: cpp + + CHECK_NOTNULL(some_ptr); + some_ptr->DoSomething(); + +Since this macro returns the given pointer, this is very useful in +constructor initializer lists. + +.. code:: cpp + + struct S { + S(Something* ptr) : ptr_(CHECK_NOTNULL(ptr)) {} + Something* ptr_; + }; + +Note that you cannot use this macro as a C++ stream due to this feature. +Please use ``CHECK_EQ`` described above to log a custom message before +aborting the application. + +If you are comparing C strings (``char *``), a handy set of macros +performs case sensitive as well as case insensitive comparisons - +``CHECK_STREQ``, ``CHECK_STRNE``, ``CHECK_STRCASEEQ``, and +``CHECK_STRCASENE``. The CASE versions are case-insensitive. You can +safely pass ``NULL`` pointers for this macro. They treat ``NULL`` and +any non-``NULL`` string as not equal. Two ``NULL``\ s are equal. + +Note that both arguments may be temporary strings which are destructed +at the end of the current "full expression" (e.g., +``CHECK_STREQ(Foo().c_str(), Bar().c_str())`` where ``Foo`` and ``Bar`` +return C++’s ``std::string``). + +The ``CHECK_DOUBLE_EQ`` macro checks the equality of two floating point +values, accepting a small error margin. ``CHECK_NEAR`` accepts a third +floating point argument, which specifies the acceptable error margin. + +Verbose Logging +~~~~~~~~~~~~~~~ + +When you are chasing difficult bugs, thorough log messages are very +useful. However, you may want to ignore too verbose messages in usual +development. For such verbose logging, glog provides the ``VLOG`` macro, +which allows you to define your own numeric logging levels. The ``--v`` +command line option controls which verbose messages are logged: + +.. code:: cpp + + VLOG(1) << "I’m printed when you run the program with --v=1 or higher"; + VLOG(2) << "I’m printed when you run the program with --v=2 or higher"; + +With ``VLOG``, the lower the verbose level, the more likely messages are +to be logged. For example, if ``--v==1``, ``VLOG(1)`` will log, but +``VLOG(2)`` will not log. This is opposite of the severity level, where +``INFO`` is 0, and ``ERROR`` is 2. ``--minloglevel`` of 1 will log +``WARNING`` and above. Though you can specify any integers for both +``VLOG`` macro and ``--v`` flag, the common values for them are small +positive integers. For example, if you write ``VLOG(0)``, you should +specify ``--v=-1`` or lower to silence it. This is less useful since we +may not want verbose logs by default in most cases. The ``VLOG`` macros +always log at the ``INFO`` log level (when they log at all). + +Verbose logging can be controlled from the command line on a per-module +basis: + +.. code:: bash + + --vmodule=mapreduce=2,file=1,gfs*=3 --v=0 + +will: + +(a) Print ``VLOG(2)`` and lower messages from mapreduce.{h,cc} +(b) Print ``VLOG(1)`` and lower messages from file.{h,cc} +(c) Print ``VLOG(3)`` and lower messages from files prefixed with "gfs" +(d) Print ``VLOG(0)`` and lower messages from elsewhere + +The wildcarding functionality shown by (c) supports both ’*’ (matches 0 +or more characters) and ’?’ (matches any single character) wildcards. +Please also check the section about `command line flags <#flags>`__. + +There’s also ``VLOG_IS_ON(n)`` "verbose level" condition macro. This +macro returns true when the ``--v`` is equal or greater than ``n``. To +be used as + +.. code:: cpp + + if (VLOG_IS_ON(2)) { + // do some logging preparation and logging + // that can’t be accomplished with just VLOG(2) << ...; + } + +Verbose level condition macros ``VLOG_IF``, ``VLOG_EVERY_N`` and +``VLOG_IF_EVERY_N`` behave analogous to ``LOG_IF``, ``LOG_EVERY_N``, +``LOF_IF_EVERY``, but accept a numeric verbosity level as opposed to a +severity level. + +.. code:: cpp + + VLOG_IF(1, (size > 1024)) + << "I’m printed when size is more than 1024 and when you run the " + "program with --v=1 or more"; + VLOG_EVERY_N(1, 10) + << "I’m printed every 10th occurrence, and when you run the program " + "with --v=1 or more. Present occurence is " << google::COUNTER; + VLOG_IF_EVERY_N(1, (size > 1024), 10) + << "I’m printed on every 10th occurence of case when size is more " + " than 1024, when you run the program with --v=1 or more. "; + "Present occurence is " << google::COUNTER; + +Failure Signal Handler +~~~~~~~~~~~~~~~~~~~~~~ + +The library provides a convenient signal handler that will dump useful +information when the program crashes on certain signals such as +``SIGSEGV``. The signal handler can be installed by +``google::InstallFailureSignalHandler()``. The following is an example +of output from the signal handler. + +:: + + *** Aborted at 1225095260 (unix time) try "date -d @1225095260" if you are using GNU date *** + *** SIGSEGV (@0x0) received by PID 17711 (TID 0x7f893090a6f0) from PID 0; stack trace: *** + PC: @ 0x412eb1 TestWaitingLogSink::send() + @ 0x7f892fb417d0 (unknown) + @ 0x412eb1 TestWaitingLogSink::send() + @ 0x7f89304f7f06 google::LogMessage::SendToLog() + @ 0x7f89304f35af google::LogMessage::Flush() + @ 0x7f89304f3739 google::LogMessage::~LogMessage() + @ 0x408cf4 TestLogSinkWaitTillSent() + @ 0x4115de main + @ 0x7f892f7ef1c4 (unknown) + @ 0x4046f9 (unknown) + +By default, the signal handler writes the failure dump to the standard +error. You can customize the destination by ``InstallFailureWriter()``. + +Performance of Messages +~~~~~~~~~~~~~~~~~~~~~~~ + +The conditional logging macros provided by glog (e.g., ``CHECK``, +``LOG_IF``, ``VLOG``, ...) are carefully implemented and don’t execute +the right hand side expressions when the conditions are false. So, the +following check may not sacrifice the performance of your application. + +.. code:: cpp + + CHECK(obj.ok) << obj.CreatePrettyFormattedStringButVerySlow(); + +User-defined Failure Function +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +``FATAL`` severity level messages or unsatisfied ``CHECK`` condition +terminate your program. You can change the behavior of the termination +by ``InstallFailureFunction``. + +.. code:: cpp + + void YourFailureFunction() { + // Reports something... + exit(1); + } + + int main(int argc, char* argv[]) { + google::InstallFailureFunction(&YourFailureFunction); + } + +By default, glog tries to dump stacktrace and makes the program exit +with status 1. The stacktrace is produced only when you run the program +on an architecture for which glog supports stack tracing (as of +September 2008, glog supports stack tracing for x86 and x86_64). + +Raw Logging +~~~~~~~~~~~ + +The header file ```` can be used for thread-safe +logging, which does not allocate any memory or acquire any locks. +Therefore, the macros defined in this header file can be used by +low-level memory allocation and synchronization code. Please check +``src/glog/raw_logging.h.in`` for detail. + +Google Style ``perror()`` +~~~~~~~~~~~~~~~~~~~~~~~~~ + +``PLOG()`` and ``PLOG_IF()`` and ``PCHECK()`` behave exactly like their +``LOG*`` and ``CHECK`` equivalents with the addition that they append a +description of the current state of errno to their output lines. E.g. + +.. code:: cpp + + PCHECK(write(1, NULL, 2) >= 0) << "Write NULL failed"; + +This check fails with the following error message. + +:: + + F0825 185142 test.cc:22] Check failed: write(1, NULL, 2) >= 0 Write NULL failed: Bad address [14] + +Syslog +~~~~~~ + +``SYSLOG``, ``SYSLOG_IF``, and ``SYSLOG_EVERY_N`` macros are available. +These log to syslog in addition to the normal logs. Be aware that +logging to syslog can drastically impact performance, especially if +syslog is configured for remote logging! Make sure you understand the +implications of outputting to syslog before you use these macros. In +general, it’s wise to use these macros sparingly. + +Strip Logging Messages +~~~~~~~~~~~~~~~~~~~~~~ + +Strings used in log messages can increase the size of your binary and +present a privacy concern. You can therefore instruct glog to remove all +strings which fall below a certain severity level by using the +``GOOGLE_STRIP_LOG`` macro: + +If your application has code like this: + +.. code:: cpp + + #define GOOGLE_STRIP_LOG 1 // this must go before the #include! + #include + +The compiler will remove the log messages whose severities are less than +the specified integer value. Since ``VLOG`` logs at the severity level +``INFO`` (numeric value ``0``), setting ``GOOGLE_STRIP_LOG`` to 1 or +greater removes all log messages associated with ``VLOG``\ s as well as +``INFO`` log statements. + +Automatically Remove Old Logs +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To enable the log cleaner: + +.. code:: cpp + + google::EnableLogCleaner(3); // keep your logs for 3 days + +And then glog will check if there are overdue logs whenever a flush is +performed. In this example, any log file from your project whose last +modified time is greater than 3 days will be unlink()ed. + +This feature can be disabled at any time (if it has been enabled) + +.. code:: cpp + + google::DisableLogCleaner(); + +Notes for Windows Users +~~~~~~~~~~~~~~~~~~~~~~~ + +glog defines a severity level ``ERROR``, which is also defined in +``windows.h`` . You can make glog not define ``INFO``, ``WARNING``, +``ERROR``, and ``FATAL`` by defining ``GLOG_NO_ABBREVIATED_SEVERITIES`` +before including ``glog/logging.h`` . Even with this macro, you can +still use the iostream like logging facilities: + +.. code:: cpp + + #define GLOG_NO_ABBREVIATED_SEVERITIES + #include + #include + + // ... + + LOG(ERROR) << "This should work"; + LOG_IF(ERROR, x > y) << "This should be also OK"; + +However, you cannot use ``INFO``, ``WARNING``, ``ERROR``, and ``FATAL`` +anymore for functions defined in ``glog/logging.h`` . + +.. code:: cpp + + #define GLOG_NO_ABBREVIATED_SEVERITIES + #include + #include + + // ... + + // This won’t work. + // google::FlushLogFiles(google::ERROR); + + // Use this instead. + google::FlushLogFiles(google::GLOG_ERROR); + +If you don’t need ``ERROR`` defined by ``windows.h``, there are a couple +of more workarounds which sometimes don’t work: + +- ``#define WIN32_LEAN_AND_MEAN`` or ``NOGDI`` **before** you + ``#include windows.h``. +- ``#undef ERROR`` **after** you ``#include windows.h`` . + +See `this +issue `__ for +more detail. + + +Installation Notes for 64-bit Linux Systems +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The glibc built-in stack-unwinder on 64-bit systems has some problems +with glog. (In particular, if you are using +InstallFailureSignalHandler(), the signal may be raised in the middle of +malloc, holding some malloc-related locks when they invoke the stack +unwinder. The built-in stack unwinder may call malloc recursively, which +may require the thread to acquire a lock it already holds: deadlock.) + +For that reason, if you use a 64-bit system and you need +``InstallFailureSignalHandler()``, we strongly recommend you install +``libunwind`` before trying to configure or install google glog. +libunwind can be found +`here `__. + +Even if you already have ``libunwind`` installed, you will probably +still need to install from the snapshot to get the latest version. + +Caution: if you install libunwind from the URL above, be aware that you +may have trouble if you try to statically link your binary with glog: +that is, if you link with ``gcc -static -lgcc_eh ...``. This is because +both ``libunwind`` and ``libgcc`` implement the same C++ exception +handling APIs, but they implement them differently on some platforms. +This is not likely to be a problem on ia64, but may be on x86-64. + +Also, if you link binaries statically, make sure that you add +``-Wl,--eh-frame-hdr`` to your linker options. This is required so that +``libunwind`` can find the information generated by the compiler +required for stack unwinding. + +Using ``-static`` is rare, though, so unless you know this will affect +you it probably won’t. + +If you cannot or do not wish to install libunwind, you can still try to +use two kinds of stack-unwinder: 1. glibc built-in stack-unwinder and 2. +frame pointer based stack-unwinder. + +1. As we already mentioned, glibc’s unwinder has a deadlock issue. + However, if you don’t use ``InstallFailureSignalHandler()`` or you + don’t worry about the rare possibilities of deadlocks, you can use + this stack-unwinder. If you specify no options and ``libunwind`` + isn’t detected on your system, the configure script chooses this + unwinder by default. + +2. The frame pointer based stack unwinder requires that your + application, the glog library, and system libraries like libc, all be + compiled with a frame pointer. This is *not* the default for x86-64. + + +How to Contribute +----------------- + +We’d love to accept your patches and contributions to this project. +There are a just a few small guidelines you need to follow. + +Contributor License Agreement (CLA) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Contributions to any Google project must be accompanied by a Contributor +License Agreement. This is not a copyright **assignment**, it simply +gives Google permission to use and redistribute your contributions as +part of the project. + +* If you are an individual writing original source code and you’re sure + you own the intellectual property, then you’ll need to sign an + `individual + CLA `__. +* If you work for a company that wants to allow you to contribute your + work, then you’ll need to sign a `corporate + CLA `__. + +You generally only need to submit a CLA once, so if you’ve already +submitted one (even if it was for a different project), you probably +don’t need to do it again. + +Once your CLA is submitted (or if you already submitted one for another +Google project), make a commit adding yourself to the +`AUTHORS <./AUTHORS>`__ and `CONTRIBUTORS `__ files. This +commit can be part of your first `pull +request `__. + +Submitting a Patch +~~~~~~~~~~~~~~~~~~ + +1. It’s generally best to start by opening a new issue describing the + bug or feature you’re intending to fix. Even if you think it’s + relatively minor, it’s helpful to know what people are working on. + Mention in the initial issue that you are planning to work on that + bug or feature so that it can be assigned to you. +2. Follow the normal process of + `forking `__ the + project, and setup a new branch to work in. It’s important that each + group of changes be done in separate branches in order to ensure that + a pull request only includes the commits related to that bug or + feature. +3. Do your best to have `well-formed commit + messages `__ + for each change. This provides consistency throughout the project, + and ensures that commit messages are able to be formatted properly by + various git tools. +4. Finally, push the commits to your fork and submit a `pull + request `__. + + +.. |Build Status| image:: https://img.shields.io/travis/google/glog/master.svg?label=Travis + :target: https://travis-ci.org/google/glog/builds +.. |Grunt status| image:: https://img.shields.io/appveyor/ci/google-admin/glog/master.svg?label=Appveyor + :target: https://ci.appveyor.com/project/google-admin/glog/history diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 08b6590..0000000 --- a/autogen.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -set -eu - -autoreconf -i diff --git a/cmake/INSTALL.md b/cmake/INSTALL.md deleted file mode 100644 index 1377d65..0000000 --- a/cmake/INSTALL.md +++ /dev/null @@ -1,81 +0,0 @@ -# Glog - CMake Support - -Glog comes with a CMake build script ([CMakeLists.txt](../CMakeLists.txt)) that can be used on a wide range of platforms. -If you don't have CMake installed already, you can download it for free from . - -CMake works by generating native makefiles or build projects that can be used in the compiler environment of your choice. -You can either build Glog with CMake as a standalone project or it can be incorporated into an existing CMake build for another project. - -## Table of Contents - -- [Building Glog with CMake](#building-glog-with-cmake) -- [Consuming Glog in a CMake Project](#consuming-glog-in-a-cmake-project) -- [Incorporating Glog into a CMake Project](#incorporating-glog-into-a-cmake-project) - -## Building Glog with CMake - -When building Glog as a standalone project, on Unix-like systems with GNU Make as build tool, the typical workflow is: - -1. Get the source code and change to it. -e.g. cloning with git: -```bash -git clone git@github.com:google/glog.git -cd glog -``` - -2. Run CMake to configure the build tree. -```bash -cmake -H. -Bbuild -G "Unix Makefiles" -``` -note: To get the list of available generators (e.g. Visual Studio), use `-G ""` - -3. Afterwards, generated files can be used to compile the project. -```bash -cmake --build build -``` - -4. Test the build software (optional). -```bash -cmake --build build --target test -``` - -5. Install the built files (optional). -```bash -cmake --build build --target install -``` - -## Consuming Glog in a CMake Project - -If you have Glog installed in your system, you can use the CMake command -`find_package()` to include it in your CMake Project. - -```cmake -cmake_minimum_required(VERSION 3.0.2) -project(myproj VERSION 1.0) - -find_package(glog 0.4.0 REQUIRED) - -add_executable(myapp main.cpp) -target_link_libraries(myapp glog::glog) -``` - -Compile definitions and options will be added automatically to your target as -needed. - -## Incorporating Glog into a CMake Project - -You can also use the CMake command `add_subdirectory()` to include Glog directly from a subdirectory of your project. -The **glog::glog** target is in this case an ALIAS library target for the **glog** library target. - -```cmake -cmake_minimum_required(VERSION 3.0.2) -project(myproj VERSION 1.0) - -add_subdirectory(glog) - -add_executable(myapp main.cpp) -target_link_libraries(myapp glog::glog) -``` - -Again, compile definitions and options will be added automatically to your target as -needed. diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 80005c2..0000000 --- a/configure.ac +++ /dev/null @@ -1,246 +0,0 @@ -## Process this file with autoconf to produce configure. -## In general, the safest way to proceed is to run the following: -## % aclocal -I . -I `pwd`/../autoconf && autoheader && autoconf && automake - -# make sure we're interpreted by some minimal autoconf -AC_PREREQ(2.57) - -AC_INIT(glog, 0.4.0, opensource@google.com) -# The argument here is just something that should be in the current directory -# (for sanity checking) -AC_CONFIG_SRCDIR(README.md) -AC_CONFIG_MACRO_DIR([m4]) -AM_INIT_AUTOMAKE -AM_CONFIG_HEADER(src/config.h) - -AC_LANG(C++) - -# Checks for programs. -AC_PROG_CC -AC_PROG_CPP -AC_PROG_CXX -AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc - -AC_PROG_LIBTOOL -AC_SUBST(LIBTOOL_DEPS) - -# Check whether some low-level functions/files are available -AC_HEADER_STDC - -# These are tested for by AC_HEADER_STDC, but I check again to set the var -AC_CHECK_HEADER(stdint.h, ac_cv_have_stdint_h=1, ac_cv_have_stdint_h=0) -AC_CHECK_HEADER(sys/types.h, ac_cv_have_systypes_h=1, ac_cv_have_systypes_h=0) -AC_CHECK_HEADER(inttypes.h, ac_cv_have_inttypes_h=1, ac_cv_have_inttypes_h=0) -AC_CHECK_HEADER(pwd.h, ac_cv_have_pwd_h=1, ac_cv_have_pwd_h=0) -AC_CHECK_HEADERS(unistd.h, ac_cv_have_unistd_h=1, ac_cv_have_unistd_h=0) -AC_CHECK_HEADERS(syscall.h) -AC_CHECK_HEADERS(sys/syscall.h) -# For backtrace with glibc. -AC_CHECK_HEADERS(execinfo.h) -# For backtrace with libunwind. -AC_CHECK_HEADERS(libunwind.h, ac_cv_have_libunwind_h=1, ac_cv_have_libunwind_h=0) -AC_CHECK_HEADERS(ucontext.h) -AC_CHECK_HEADERS(sys/utsname.h) -AC_CHECK_HEADERS(pwd.h) -AC_CHECK_HEADERS(syslog.h) -AC_CHECK_HEADERS(sys/time.h) -AC_CHECK_HEADERS(glob.h) -# For backtrace with gcc. -AC_CHECK_HEADERS(unwind.h) - -AC_CHECK_HEADER(windows.h, ac_cv_have_windows_h=1, ac_cv_have_windows_h=0) -if test x"$ac_cv_have_windows_h" = x"1"; then - MINGW_CFLAGS=-Isrc/windows -fi - -AC_CHECK_SIZEOF(void *) - -# These are the types I need. We look for them in either stdint.h, -# sys/types.h, or inttypes.h, all of which are part of the default-includes. -AC_CHECK_TYPE(uint16_t, ac_cv_have_uint16_t=1, ac_cv_have_uint16_t=0) -AC_CHECK_TYPE(u_int16_t, ac_cv_have_u_int16_t=1, ac_cv_have_u_int16_t=0) -AC_CHECK_TYPE(__uint16, ac_cv_have___uint16=1, ac_cv_have___uint16=0) - -AC_CHECK_FUNC(sigaltstack, - AC_DEFINE(HAVE_SIGALTSTACK, 1, - [Define if you have the `sigaltstack' function])) -AC_CHECK_FUNC(sigaction, - AC_DEFINE(HAVE_SIGACTION, 1, - [Define if you have the 'sigaction' function])) -AC_CHECK_FUNC(dladdr, - AC_DEFINE(HAVE_DLADDR, 1, - [Define if you have the `dladdr' function])) -AC_CHECK_FUNC(fcntl, - AC_DEFINE(HAVE_FCNTL, 1, - [Define if you have the `fcntl' function])) -AC_CHECK_FUNC(pread, - AC_DEFINE(HAVE_PREAD, 1, - [Define if you have the 'pread' function])) -AC_CHECK_FUNC(pwrite, - AC_DEFINE(HAVE_PWRITE, 1, - [Define if you have the 'pwrite' function])) - -AX_C___ATTRIBUTE__ -# We only care about these two attributes. -if test x"$ac_cv___attribute__" = x"yes"; then - ac_cv___attribute___noreturn="__attribute__ ((noreturn))" - ac_cv___attribute___noinline="__attribute__ ((noinline))" - ac_cv___attribute___printf_4_5="__attribute__((__format__ (__printf__, 4, 5)))" -else - ac_cv___attribute___noreturn= - ac_cv___attribute___noinline= - ac_cv___attribute___printf_4_5= -fi - -AX_C___BUILTIN_EXPECT -if test x"$ac_cv___builtin_expect" = x"yes"; then - ac_cv_have___builtin_expect=1 -else - ac_cv_have___builtin_expect=0 -fi - -AX_C___SYNC_VAL_COMPARE_AND_SWAP - -# On x86_64, instead of libunwind, we can choose to compile with frame-pointers -# (This isn't needed on i386, where -fno-omit-frame-pointer is the default). -AC_ARG_ENABLE(frame_pointers, - AS_HELP_STRING([--enable-frame-pointers], - [On x86_64 systems, compile with -fno-omit-frame-pointer (see INSTALL)]),, - enable_frame_pointers=no) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [return __x86_64__ == 1 ? 0 : 1])], - [is_x86_64=yes], [is_x86_64=no]) -AM_CONDITIONAL(ENABLE_FRAME_POINTERS, test "$enable_frame_pointers" = yes) -AM_CONDITIONAL(X86_64, test "$is_x86_64" = yes) - -AC_ARG_ENABLE(rtti, - AS_HELP_STRING([--disable-rtti], - [Disable RTTI in glog])) -AM_CONDITIONAL(DISABLE_RTTI, test x"$enable_rtti" = x"no") -if test x"$enable_rtti" = x"no"; then - AC_DEFINE(DISABLE_RTTI, 1, [define if glog doesn't use RTTI]) -fi - -# Some of the code in this directory depends on pthreads -ACX_PTHREAD -if test x"$acx_pthread_ok" = x"yes"; then - # To make libglog depend on libpthread on Linux, we need to add - # -lpthread in addition to -pthread. - AC_CHECK_LIB(pthread, pthread_self) -fi - -# Check if there is google-gflags library installed. -SAVE_CFLAGS="$CFLAGS" -SAVE_LIBS="$LIBS" -AC_ARG_WITH(gflags, AS_HELP_STRING[--with-gflags=GFLAGS_DIR], - GFLAGS_CFLAGS="-I${with_gflags}/include" - GFLAGS_LIBS="-L${with_gflags}/lib -lgflags" - CFLAGS="$CFLAGS $GFLAGS_CFLAGS" - LIBS="$LIBS $GFLAGS_LIBS" -) -AC_CHECK_LIB(gflags, main, ac_cv_have_libgflags=1, ac_cv_have_libgflags=0) -if test x"$ac_cv_have_libgflags" = x"1"; then - AC_DEFINE(HAVE_LIB_GFLAGS, 1, [define if you have google gflags library]) - if test x"$GFLAGS_LIBS" = x""; then - GFLAGS_LIBS="-lgflags" - fi -else - GFLAGS_CFLAGS= - GFLAGS_LIBS= -fi -CFLAGS="$SAVE_CFLAGS" -LIBS="$SAVE_LIBS" - -# TODO(hamaji): Use official m4 macros provided by testing libraries -# once the m4 macro of Google Mocking becomes ready. -# Check if there is Google Test library installed. -AC_CHECK_PROG(GTEST_CONFIG, gtest-config, "yes") -AC_CHECK_LIB(gtest, main, have_gtest_lib="yes") -if test x"$GTEST_CONFIG" = "xyes" -a x"$have_gtest_lib" = "xyes"; then - GTEST_CFLAGS=`gtest-config --cppflags --cxxflags` - GTEST_LIBS=`gtest-config --ldflags --libs` - AC_DEFINE(HAVE_LIB_GTEST, 1, [define if you have google gtest library]) - - # Check if there is Google Mocking library installed. - AC_CHECK_PROG(GMOCK_CONFIG, gmock-config, "yes") - if test x"$GMOCK_CONFIG" = "xyes"; then - GMOCK_CFLAGS=`gmock-config --cppflags --cxxflags` - GMOCK_LIBS=`gmock-config --ldflags --libs` - AC_DEFINE(HAVE_LIB_GMOCK, 1, [define if you have google gmock library]) - else - # We don't run test cases which use Google Mocking framework. - GMOCK_CFLAGS= - GMOCK_LIBS= - fi -else - # We'll use src/googletest.h for our unittests. - GTEST_CFLAGS= - GTEST_LIBS= -fi -AM_CONDITIONAL(HAVE_GMOCK, test x"$GMOCK_CONFIG" = "xyes") - -# We want to link in libunwind if it exists -UNWIND_LIBS= -# Unfortunately, we need to check the header file in addition to the -# lib file to check if libunwind is available since libunwind-0.98 -# doesn't install all necessary header files. -if test x"$ac_cv_have_libunwind_h" = x"1"; then - AC_CHECK_LIB(unwind, backtrace, UNWIND_LIBS=-lunwind) -fi -AC_SUBST(UNWIND_LIBS) -if test x"$UNWIND_LIBS" != x""; then - AC_DEFINE(HAVE_LIB_UNWIND, 1, [define if you have libunwind]) -fi - -# We'd like to use read/write locks in several places in the code. -# See if our pthreads support extends to that. Note: for linux, it -# does as long as you define _XOPEN_SOURCE appropriately. -AC_RWLOCK - -# Find out what namespace 'normal' STL code lives in, and also what namespace -# the user wants our classes to be defined in -AC_CXX_STL_NAMESPACE -AC_DEFINE_GOOGLE_NAMESPACE(google) - -AC_CXX_USING_OPERATOR - -AC_PC_FROM_UCONTEXT(AC_MSG_WARN(Could not find the PC. Will not output failed addresses...)) - -AC_DEFINE_UNQUOTED(TEST_SRC_DIR, "$srcdir", [location of source code]) - -AC_ARG_ENABLE(unsymbolized-traces, - AS_HELP_STRING([--enable-unsymbolized-traces], - [Print file offsets in traces instead of symbolizing.]), - enable_unsymbolized_traces=yes) -if test x"$enable_unsymbolized_traces" = x"yes"; then - AC_DEFINE(PRINT_UNSYMBOLIZED_STACK_TRACES, 1, - [define if we should print file offsets in traces instead of symbolizing.]) -fi - -# These are what's needed by logging.h.in and raw_logging.h.in -AC_SUBST(ac_google_start_namespace) -AC_SUBST(ac_google_end_namespace) -AC_SUBST(ac_google_namespace) -AC_SUBST(ac_cv_cxx_using_operator) -AC_SUBST(ac_cv___attribute___noreturn) -AC_SUBST(ac_cv___attribute___noinline) -AC_SUBST(ac_cv___attribute___printf_4_5) -AC_SUBST(ac_cv_have___builtin_expect) -AC_SUBST(ac_cv_have_stdint_h) -AC_SUBST(ac_cv_have_systypes_h) -AC_SUBST(ac_cv_have_inttypes_h) -AC_SUBST(ac_cv_have_unistd_h) -AC_SUBST(ac_cv_have_uint16_t) -AC_SUBST(ac_cv_have_u_int16_t) -AC_SUBST(ac_cv_have___uint16) -AC_SUBST(ac_cv_have_libgflags) -AC_SUBST(GFLAGS_CFLAGS) -AC_SUBST(GTEST_CFLAGS) -AC_SUBST(GMOCK_CFLAGS) -AC_SUBST(MINGW_CFLAGS) -AC_SUBST(GFLAGS_LIBS) -AC_SUBST(GTEST_LIBS) -AC_SUBST(GMOCK_LIBS) - -# Write generated configuration file -AC_CONFIG_FILES([Makefile src/glog/logging.h src/glog/raw_logging.h src/glog/vlog_is_on.h src/glog/stl_logging.h]) -AC_OUTPUT(libglog.pc) diff --git a/doc/designstyle.css b/doc/designstyle.css deleted file mode 100644 index f5d1ec2..0000000 --- a/doc/designstyle.css +++ /dev/null @@ -1,115 +0,0 @@ -body { - background-color: #ffffff; - color: black; - margin-right: 1in; - margin-left: 1in; -} - - -h1, h2, h3, h4, h5, h6 { - color: #3366ff; - font-family: sans-serif; -} -@media print { - /* Darker version for printing */ - h1, h2, h3, h4, h5, h6 { - color: #000080; - font-family: helvetica, sans-serif; - } -} - -h1 { - text-align: center; - font-size: 18pt; -} -h2 { - margin-left: -0.5in; -} -h3 { - margin-left: -0.25in; -} -h4 { - margin-left: -0.125in; -} -hr { - margin-left: -1in; -} - -/* Definition lists: definition term bold */ -dt { - font-weight: bold; -} - -address { - text-align: right; -} -/* Use the tag for bits of code and for variables and objects. */ -code,pre,samp,var { - color: #006000; -} -/* Use the tag for file and directory paths and names. */ -file { - color: #905050; - font-family: monospace; -} -/* Use the tag for stuff the user should type. */ -kbd { - color: #600000; -} -div.note p { - float: right; - width: 3in; - margin-right: 0%; - padding: 1px; - border: 2px solid #6060a0; - background-color: #fffff0; -} - -UL.nobullets { - list-style-type: none; - list-style-image: none; - margin-left: -1em; -} - -/* -body:after { - content: "Google Confidential"; -} -*/ - -/* pretty printing styles. See prettify.js */ -.str { color: #080; } -.kwd { color: #008; } -.com { color: #800; } -.typ { color: #606; } -.lit { color: #066; } -.pun { color: #660; } -.pln { color: #000; } -.tag { color: #008; } -.atn { color: #606; } -.atv { color: #080; } -pre.prettyprint { padding: 2px; border: 1px solid #888; } - -.embsrc { background: #eee; } - -@media print { - .str { color: #060; } - .kwd { color: #006; font-weight: bold; } - .com { color: #600; font-style: italic; } - .typ { color: #404; font-weight: bold; } - .lit { color: #044; } - .pun { color: #440; } - .pln { color: #000; } - .tag { color: #006; font-weight: bold; } - .atn { color: #404; } - .atv { color: #060; } -} - -/* Table Column Headers */ -.hdr { - color: #006; - font-weight: bold; - background-color: #dddddd; } -.hdr2 { - color: #006; - background-color: #eeeeee; } \ No newline at end of file diff --git a/doc/glog.html b/doc/glog.html deleted file mode 100644 index 699d2ce..0000000 --- a/doc/glog.html +++ /dev/null @@ -1,631 +0,0 @@ - - - - -How To Use Google Logging Library (glog) - - - - - - - - - -

How To Use Google Logging Library (glog)

-(as of -) - -
- -
- -

Google glog is a library that implements application-level -logging. This library provides logging APIs based on C++-style -streams and various helper macros. -You can log a message by simply streaming things to LOG(<a -particular severity level>), e.g. - -

-   #include <glog/logging.h>
-
-   int main(int argc, char* argv[]) {
-     // Initialize Google's logging library.
-     google::InitGoogleLogging(argv[0]);
-
-     // ...
-     LOG(INFO) << "Found " << num_cookies << " cookies";
-   }
-
- -

Google glog defines a series of macros that simplify many common logging -tasks. You can log messages by severity level, control logging -behavior from the command line, log based on conditionals, abort the -program when expected conditions are not met, introduce your own -verbose logging levels, and more. This document describes the -functionality supported by glog. Please note that this document -doesn't describe all features in this library, but the most useful -ones. If you want to find less common features, please check -header files under src/glog directory. - -

Severity Level

- -

-You can specify one of the following severity levels (in -increasing order of severity): INFO, WARNING, -ERROR, and FATAL. -Logging a FATAL message terminates the program (after the -message is logged). -Note that messages of a given severity are logged not only in the -logfile for that severity, but also in all logfiles of lower severity. -E.g., a message of severity FATAL will be logged to the -logfiles of severity FATAL, ERROR, -WARNING, and INFO. - -

-The DFATAL severity logs a FATAL error in -debug mode (i.e., there is no NDEBUG macro defined), but -avoids halting the program in production by automatically reducing the -severity to ERROR. - -

Unless otherwise specified, glog writes to the filename -"/tmp/<program name>.<hostname>.<user name>.log.<severity level>.<date>.<time>.<pid>" -(e.g., "/tmp/hello_world.example.com.hamaji.log.INFO.20080709-222411.10474"). -By default, glog copies the log messages of severity level -ERROR or FATAL to standard error (stderr) -in addition to log files. - -

Setting Flags

- -

Several flags influence glog's output behavior. -If the Google -gflags library is installed on your machine, the -configure script (see the INSTALL file in the package for -detail of this script) will automatically detect and use it, -allowing you to pass flags on the command line. For example, if you -want to turn the flag --logtostderr on, you can start -your application with the following command line: - -

-   ./your_application --logtostderr=1
-
- -If the Google gflags library isn't installed, you set flags via -environment variables, prefixing the flag name with "GLOG_", e.g. - -
-   GLOG_logtostderr=1 ./your_application
-
- - - -

The following flags are most commonly used: - -

-
logtostderr (bool, default=false) -
Log messages to stderr instead of logfiles.
-Note: you can set binary flags to true by specifying -1, true, or yes (case -insensitive). -Also, you can set binary flags to false by specifying -0, false, or no (again, case -insensitive). -
stderrthreshold (int, default=2, which -is ERROR) -
Copy log messages at or above this level to stderr in -addition to logfiles. The numbers of severity levels -INFO, WARNING, ERROR, and -FATAL are 0, 1, 2, and 3, respectively. -
minloglevel (int, default=0, which -is INFO) -
Log messages at or above this level. Again, the numbers of -severity levels INFO, WARNING, -ERROR, and FATAL are 0, 1, 2, and 3, -respectively. -
log_dir (string, default="") -
If specified, logfiles are written into this directory instead -of the default logging directory. -
v (int, default=0) -
Show all VLOG(m) messages for m less or -equal the value of this flag. Overridable by --vmodule. -See the section about verbose logging for more -detail. -
vmodule (string, default="") -
Per-module verbose level. The argument has to contain a -comma-separated list of <module name>=<log level>. -<module name> -is a glob pattern (e.g., gfs* for all modules whose name -starts with "gfs"), matched against the filename base -(that is, name ignoring .cc/.h./-inl.h). -<log level> overrides any value given by --v. -See also the section about verbose logging. -
- -

There are some other flags defined in logging.cc. Please grep the -source code for "DEFINE_" to see a complete list of all flags. - -

You can also modify flag values in your program by modifying global -variables FLAGS_* . Most settings start working -immediately after you update FLAGS_* . The exceptions are -the flags related to destination files. For example, you might want to -set FLAGS_log_dir before -calling google::InitGoogleLogging . Here is an example: - -

-   LOG(INFO) << "file";
-   // Most flags work immediately after updating values.
-   FLAGS_logtostderr = 1;
-   LOG(INFO) << "stderr";
-   FLAGS_logtostderr = 0;
-   // This won't change the log destination. If you want to set this
-   // value, you should do this before google::InitGoogleLogging .
-   FLAGS_log_dir = "/some/log/directory";
-   LOG(INFO) << "the same file";
-
- -

Conditional / Occasional Logging

- -

Sometimes, you may only want to log a message under certain -conditions. You can use the following macros to perform conditional -logging: - -

-   LOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
-
- -The "Got lots of cookies" message is logged only when the variable -num_cookies exceeds 10. - -If a line of code is executed many times, it may be useful to only log -a message at certain intervals. This kind of logging is most useful -for informational messages. - -
-   LOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
-
- -

The above line outputs a log messages on the 1st, 11th, -21st, ... times it is executed. Note that the special -google::COUNTER value is used to identify which repetition is -happening. - -

You can combine conditional and occasional logging with the -following macro. - -

-   LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << google::COUNTER
-                                           << "th big cookie";
-
- -

Instead of outputting a message every nth time, you can also limit -the output to the first n occurrences: - -

-   LOG_FIRST_N(INFO, 20) << "Got the " << google::COUNTER << "th cookie";
-
- -

Outputs log messages for the first 20 times it is executed. Again, -the google::COUNTER identifier indicates which repetition is -happening. - -

Debug Mode Support

- -

Special "debug mode" logging macros only have an effect in debug -mode and are compiled away to nothing for non-debug mode -compiles. Use these macros to avoid slowing down your production -application due to excessive logging. - -

-   DLOG(INFO) << "Found cookies";
-
-   DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
-
-   DLOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
-
- -

CHECK Macros

- -

It is a good practice to check expected conditions in your program -frequently to detect errors as early as possible. The -CHECK macro provides the ability to abort the application -when a condition is not met, similar to the assert macro -defined in the standard C library. - -

CHECK aborts the application if a condition is not -true. Unlike assert, it is *not* controlled by -NDEBUG, so the check will be executed regardless of -compilation mode. Therefore, fp->Write(x) in the -following example is always executed: - -

-   CHECK(fp->Write(x) == 4) << "Write failed!";
-
- -

There are various helper macros for -equality/inequality checks - CHECK_EQ, -CHECK_NE, CHECK_LE, CHECK_LT, -CHECK_GE, and CHECK_GT. -They compare two values, and log a -FATAL message including the two values when the result is -not as expected. The values must have operator<<(ostream, -...) defined. - -

You may append to the error message like so: - -

-   CHECK_NE(1, 2) << ": The world must be ending!";
-
- -

We are very careful to ensure that each argument is evaluated exactly -once, and that anything which is legal to pass as a function argument is -legal here. In particular, the arguments may be temporary expressions -which will end up being destroyed at the end of the apparent statement, -for example: - -

-   CHECK_EQ(string("abc")[1], 'b');
-
- -

The compiler reports an error if one of the arguments is a -pointer and the other is NULL. To work around this, simply static_cast -NULL to the type of the desired pointer. - -

-   CHECK_EQ(some_ptr, static_cast<SomeType*>(NULL));
-
- -

Better yet, use the CHECK_NOTNULL macro: - -

-   CHECK_NOTNULL(some_ptr);
-   some_ptr->DoSomething();
-
- -

Since this macro returns the given pointer, this is very useful in -constructor initializer lists. - -

-   struct S {
-     S(Something* ptr) : ptr_(CHECK_NOTNULL(ptr)) {}
-     Something* ptr_;
-   };
-
- -

Note that you cannot use this macro as a C++ stream due to this -feature. Please use CHECK_EQ described above to log a -custom message before aborting the application. - -

If you are comparing C strings (char *), a handy set of macros -performs case sensitive as well as case insensitive comparisons - -CHECK_STREQ, CHECK_STRNE, -CHECK_STRCASEEQ, and CHECK_STRCASENE. The -CASE versions are case-insensitive. You can safely pass NULL -pointers for this macro. They treat NULL and any -non-NULL string as not equal. Two NULLs are -equal. - -

Note that both arguments may be temporary strings which are -destructed at the end of the current "full expression" -(e.g., CHECK_STREQ(Foo().c_str(), Bar().c_str()) where -Foo and Bar return C++'s -std::string). - -

The CHECK_DOUBLE_EQ macro checks the equality of two -floating point values, accepting a small error margin. -CHECK_NEAR accepts a third floating point argument, which -specifies the acceptable error margin. - -

Verbose Logging

- -

When you are chasing difficult bugs, thorough log messages are very -useful. However, you may want to ignore too verbose messages in usual -development. For such verbose logging, glog provides the -VLOG macro, which allows you to define your own numeric -logging levels. The --v command line option controls -which verbose messages are logged: - -

-   VLOG(1) << "I'm printed when you run the program with --v=1 or higher";
-   VLOG(2) << "I'm printed when you run the program with --v=2 or higher";
-
- -

With VLOG, the lower the verbose level, the more -likely messages are to be logged. For example, if ---v==1, VLOG(1) will log, but -VLOG(2) will not log. This is opposite of the severity -level, where INFO is 0, and ERROR is 2. ---minloglevel of 1 will log WARNING and -above. Though you can specify any integers for both VLOG -macro and --v flag, the common values for them are small -positive integers. For example, if you write VLOG(0), -you should specify --v=-1 or lower to silence it. This -is less useful since we may not want verbose logs by default in most -cases. The VLOG macros always log at the -INFO log level (when they log at all). - -

Verbose logging can be controlled from the command line on a -per-module basis: - -

-   --vmodule=mapreduce=2,file=1,gfs*=3 --v=0
-
- -

will: - -

    -
  • a. Print VLOG(2) and lower messages from mapreduce.{h,cc} -
  • b. Print VLOG(1) and lower messages from file.{h,cc} -
  • c. Print VLOG(3) and lower messages from files prefixed with "gfs" -
  • d. Print VLOG(0) and lower messages from elsewhere -
- -

The wildcarding functionality shown by (c) supports both '*' -(matches 0 or more characters) and '?' (matches any single character) -wildcards. Please also check the section about command line flags. - -

There's also VLOG_IS_ON(n) "verbose level" condition -macro. This macro returns true when the --v is equal or -greater than n. To be used as - -

-   if (VLOG_IS_ON(2)) {
-     // do some logging preparation and logging
-     // that can't be accomplished with just VLOG(2) << ...;
-   }
-
- -

Verbose level condition macros VLOG_IF, -VLOG_EVERY_N and VLOG_IF_EVERY_N behave -analogous to LOG_IF, LOG_EVERY_N, -LOF_IF_EVERY, but accept a numeric verbosity level as -opposed to a severity level. - -

-   VLOG_IF(1, (size > 1024))
-      << "I'm printed when size is more than 1024 and when you run the "
-         "program with --v=1 or more";
-   VLOG_EVERY_N(1, 10)
-      << "I'm printed every 10th occurrence, and when you run the program "
-         "with --v=1 or more. Present occurence is " << google::COUNTER;
-   VLOG_IF_EVERY_N(1, (size > 1024), 10)
-      << "I'm printed on every 10th occurence of case when size is more "
-         " than 1024, when you run the program with --v=1 or more. ";
-         "Present occurence is " << google::COUNTER;
-
- -

Failure Signal Handler

- -

-The library provides a convenient signal handler that will dump useful -information when the program crashes on certain signals such as SIGSEGV. -The signal handler can be installed by -google::InstallFailureSignalHandler(). The following is an example of output -from the signal handler. - -

-*** Aborted at 1225095260 (unix time) try "date -d @1225095260" if you are using GNU date ***
-*** SIGSEGV (@0x0) received by PID 17711 (TID 0x7f893090a6f0) from PID 0; stack trace: ***
-PC: @           0x412eb1 TestWaitingLogSink::send()
-    @     0x7f892fb417d0 (unknown)
-    @           0x412eb1 TestWaitingLogSink::send()
-    @     0x7f89304f7f06 google::LogMessage::SendToLog()
-    @     0x7f89304f35af google::LogMessage::Flush()
-    @     0x7f89304f3739 google::LogMessage::~LogMessage()
-    @           0x408cf4 TestLogSinkWaitTillSent()
-    @           0x4115de main
-    @     0x7f892f7ef1c4 (unknown)
-    @           0x4046f9 (unknown)
-
- -

-By default, the signal handler writes the failure dump to the standard -error. You can customize the destination by InstallFailureWriter(). - -

Miscellaneous Notes

- -

Performance of Messages

- -

The conditional logging macros provided by glog (e.g., -CHECK, LOG_IF, VLOG, ...) are -carefully implemented and don't execute the right hand side -expressions when the conditions are false. So, the following check -may not sacrifice the performance of your application. - -

-   CHECK(obj.ok) << obj.CreatePrettyFormattedStringButVerySlow();
-
- -

User-defined Failure Function

- -

FATAL severity level messages or unsatisfied -CHECK condition terminate your program. You can change -the behavior of the termination by -InstallFailureFunction. - -

-   void YourFailureFunction() {
-     // Reports something...
-     exit(1);
-   }
-
-   int main(int argc, char* argv[]) {
-     google::InstallFailureFunction(&YourFailureFunction);
-   }
-
- -

By default, glog tries to dump stacktrace and makes the program -exit with status 1. The stacktrace is produced only when you run the -program on an architecture for which glog supports stack tracing (as -of September 2008, glog supports stack tracing for x86 and x86_64). - -

Raw Logging

- -

The header file <glog/raw_logging.h> can be -used for thread-safe logging, which does not allocate any memory or -acquire any locks. Therefore, the macros defined in this -header file can be used by low-level memory allocation and -synchronization code. -Please check src/glog/raw_logging.h.in for detail. -

- -

Google Style perror()

- -

PLOG() and PLOG_IF() and -PCHECK() behave exactly like their LOG* and -CHECK equivalents with the addition that they append a -description of the current state of errno to their output lines. -E.g. - -

-   PCHECK(write(1, NULL, 2) >= 0) << "Write NULL failed";
-
- -

This check fails with the following error message. - -

-   F0825 185142 test.cc:22] Check failed: write(1, NULL, 2) >= 0 Write NULL failed: Bad address [14]
-
- -

Syslog

- -

SYSLOG, SYSLOG_IF, and -SYSLOG_EVERY_N macros are available. -These log to syslog in addition to the normal logs. Be aware that -logging to syslog can drastically impact performance, especially if -syslog is configured for remote logging! Make sure you understand the -implications of outputting to syslog before you use these macros. In -general, it's wise to use these macros sparingly. - -

Strip Logging Messages

- -

Strings used in log messages can increase the size of your binary -and present a privacy concern. You can therefore instruct glog to -remove all strings which fall below a certain severity level by using -the GOOGLE_STRIP_LOG macro: - -

If your application has code like this: - -

-   #define GOOGLE_STRIP_LOG 1    // this must go before the #include!
-   #include <glog/logging.h>
-
- -

The compiler will remove the log messages whose severities are less -than the specified integer value. Since -VLOG logs at the severity level INFO -(numeric value 0), -setting GOOGLE_STRIP_LOG to 1 or greater removes -all log messages associated with VLOGs as well as -INFO log statements. - -

Automatically Remove Old Logs

- -

To enable the log cleaner: - -

-google::EnableLogCleaner(3); // keep your logs for 3 days
-
- -And then Google glog will check if there are overdue logs whenever -a flush is performed. In this example, any log file from your project whose -last modified time is greater than 3 days will be unlink()ed. - -

This feature can be disabled at any time (if it has been enabled) - -

-google::DisableLogCleaner();
-
- -

Notes for Windows users

- -

Google glog defines a severity level ERROR, which is -also defined in windows.h . You can make glog not define -INFO, WARNING, ERROR, -and FATAL by defining -GLOG_NO_ABBREVIATED_SEVERITIES before -including glog/logging.h . Even with this macro, you can -still use the iostream like logging facilities: - -

-  #define GLOG_NO_ABBREVIATED_SEVERITIES
-  #include <windows.h>
-  #include <glog/logging.h>
-
-  // ...
-
-  LOG(ERROR) << "This should work";
-  LOG_IF(ERROR, x > y) << "This should be also OK";
-
- -

-However, you cannot -use INFO, WARNING, ERROR, -and FATAL anymore for functions defined -in glog/logging.h . - -

-  #define GLOG_NO_ABBREVIATED_SEVERITIES
-  #include <windows.h>
-  #include <glog/logging.h>
-
-  // ...
-
-  // This won't work.
-  // google::FlushLogFiles(google::ERROR);
-
-  // Use this instead.
-  google::FlushLogFiles(google::GLOG_ERROR);
-
- -

-If you don't need ERROR defined -by windows.h, there are a couple of more workarounds -which sometimes don't work: - -

    -
  • #define WIN32_LEAN_AND_MEAN or NOGDI - before you #include windows.h . -
  • #undef ERROR after you #include - windows.h . -
- -

See -this issue for more detail. - -


-
-Shinichiro Hamaji
-Gregor Hohpe
- -
- - - diff --git a/m4/ac_have_attribute.m4 b/m4/ac_have_attribute.m4 deleted file mode 100644 index 19f4021..0000000 --- a/m4/ac_have_attribute.m4 +++ /dev/null @@ -1,16 +0,0 @@ -AC_DEFUN([AX_C___ATTRIBUTE__], [ - AC_MSG_CHECKING(for __attribute__) - AC_CACHE_VAL(ac_cv___attribute__, [ - AC_TRY_COMPILE( - [#include - static void foo(void) __attribute__ ((unused)); - void foo(void) { exit(1); }], - [], - ac_cv___attribute__=yes, - ac_cv___attribute__=no - )]) - if test "$ac_cv___attribute__" = "yes"; then - AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__]) - fi - AC_MSG_RESULT($ac_cv___attribute__) -]) diff --git a/m4/ac_have_builtin_expect.m4 b/m4/ac_have_builtin_expect.m4 deleted file mode 100644 index e91b6fd..0000000 --- a/m4/ac_have_builtin_expect.m4 +++ /dev/null @@ -1,14 +0,0 @@ -AC_DEFUN([AX_C___BUILTIN_EXPECT], [ - AC_MSG_CHECKING(for __builtin_expect) - AC_CACHE_VAL(ac_cv___builtin_expect, [ - AC_TRY_COMPILE( - [int foo(void) { if (__builtin_expect(0, 0)) return 1; return 0; }], - [], - ac_cv___builtin_expect=yes, - ac_cv___builtin_expect=no - )]) - if test "$ac_cv___builtin_expect" = "yes"; then - AC_DEFINE(HAVE___BUILTIN_EXPECT, 1, [define if your compiler has __builtin_expect]) - fi - AC_MSG_RESULT($ac_cv___builtin_expect) -]) diff --git a/m4/ac_have_sync_val_compare_and_swap.m4 b/m4/ac_have_sync_val_compare_and_swap.m4 deleted file mode 100644 index 88b027e..0000000 --- a/m4/ac_have_sync_val_compare_and_swap.m4 +++ /dev/null @@ -1,14 +0,0 @@ -AC_DEFUN([AX_C___SYNC_VAL_COMPARE_AND_SWAP], [ - AC_MSG_CHECKING(for __sync_val_compare_and_swap) - AC_CACHE_VAL(ac_cv___sync_val_compare_and_swap, [ - AC_TRY_LINK( - [], - [int a; if (__sync_val_compare_and_swap(&a, 0, 1)) return 1; return 0;], - ac_cv___sync_val_compare_and_swap=yes, - ac_cv___sync_val_compare_and_swap=no - )]) - if test "$ac_cv___sync_val_compare_and_swap" = "yes"; then - AC_DEFINE(HAVE___SYNC_VAL_COMPARE_AND_SWAP, 1, [define if your compiler has __sync_val_compare_and_swap]) - fi - AC_MSG_RESULT($ac_cv___sync_val_compare_and_swap) -]) diff --git a/m4/ac_rwlock.m4 b/m4/ac_rwlock.m4 deleted file mode 100644 index 5065bcc..0000000 --- a/m4/ac_rwlock.m4 +++ /dev/null @@ -1,31 +0,0 @@ -# TODO(csilvers): it would be better to actually try to link against -# -pthreads, to make sure it defines these methods, but that may be -# too hard, since pthread support is really tricky. - -# Check for support for pthread_rwlock_init() etc. -# These aren't posix, but are widely supported. To get them on linux, -# you need to define _XOPEN_SOURCE first, so this check assumes your -# application does that. -# -# Note: OS X (as of 6/1/06) seems to support pthread_rwlock, but -# doesn't define PTHREAD_RWLOCK_INITIALIZER. Therefore, we don't test -# that particularly macro. It's probably best if you don't use that -# macro in your code either. - -AC_DEFUN([AC_RWLOCK], -[AC_CACHE_CHECK(support for pthread_rwlock_* functions, -ac_cv_rwlock, -[AC_LANG_SAVE - AC_LANG_C - AC_TRY_COMPILE([#define _XOPEN_SOURCE 500 - #include ], - [pthread_rwlock_t l; pthread_rwlock_init(&l, NULL); - pthread_rwlock_rdlock(&l); - return 0;], - ac_cv_rwlock=yes, ac_cv_rwlock=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_rwlock" = yes; then - AC_DEFINE(HAVE_RWLOCK,1,[define if the compiler implements pthread_rwlock_*]) -fi -]) diff --git a/m4/acx_pthread.m4 b/m4/acx_pthread.m4 deleted file mode 100644 index 2cf20de..0000000 --- a/m4/acx_pthread.m4 +++ /dev/null @@ -1,363 +0,0 @@ -# This was retrieved from -# http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?revision=1277&root=avahi -# See also (perhaps for new versions?) -# http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?root=avahi -# -# We've rewritten the inconsistency check code (from avahi), to work -# more broadly. In particular, it no longer assumes ld accepts -zdefs. -# This caused a restructing of the code, but the functionality has only -# changed a little. - -dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -dnl -dnl @summary figure out how to build C programs using POSIX threads -dnl -dnl This macro figures out how to build C programs using POSIX threads. -dnl It sets the PTHREAD_LIBS output variable to the threads library and -dnl linker flags, and the PTHREAD_CFLAGS output variable to any special -dnl C compiler flags that are needed. (The user can also force certain -dnl compiler flags/libs to be tested by setting these environment -dnl variables.) -dnl -dnl Also sets PTHREAD_CC to any special C compiler that is needed for -dnl multi-threaded programs (defaults to the value of CC otherwise). -dnl (This is necessary on AIX to use the special cc_r compiler alias.) -dnl -dnl NOTE: You are assumed to not only compile your program with these -dnl flags, but also link it with them as well. e.g. you should link -dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS -dnl $LIBS -dnl -dnl If you are only building threads programs, you may wish to use -dnl these variables in your default LIBS, CFLAGS, and CC: -dnl -dnl LIBS="$PTHREAD_LIBS $LIBS" -dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -dnl CC="$PTHREAD_CC" -dnl -dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute -dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to -dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). -dnl -dnl ACTION-IF-FOUND is a list of shell commands to run if a threads -dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to -dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the -dnl default action will define HAVE_PTHREAD. -dnl -dnl Please let the authors know if this macro fails on any platform, or -dnl if you have any other suggestions or comments. This macro was based -dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with -dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros -dnl posted by Alejandro Forero Cuervo to the autoconf macro repository. -dnl We are also grateful for the helpful feedback of numerous users. -dnl -dnl @category InstalledPackages -dnl @author Steven G. Johnson -dnl @version 2006-05-29 -dnl @license GPLWithACException -dnl -dnl Checks for GCC shared/pthread inconsistency based on work by -dnl Marcin Owsiany - - -AC_DEFUN([ACX_PTHREAD], [ -AC_REQUIRE([AC_CANONICAL_HOST]) -AC_LANG_SAVE -AC_LANG_C -acx_pthread_ok=no - -# We used to check for pthread.h first, but this fails if pthread.h -# requires special compiler flags (e.g. on True64 or Sequent). -# It gets checked for in the link test anyway. - -# First of all, check if the user has set any of the PTHREAD_LIBS, -# etcetera environment variables, and if threads linking works using -# them: -if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) - AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) - AC_MSG_RESULT($acx_pthread_ok) - if test x"$acx_pthread_ok" = xno; then - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" -fi - -# We must check for the threads library under a number of different -# names; the ordering is very important because some systems -# (e.g. DEC) have both -lpthread and -lpthreads, where one of the -# libraries is broken (non-POSIX). - -# Create a list of thread flags to try. Items starting with a "-" are -# C compiler flags, and other items are library names, except for "none" -# which indicates that we try without any flags at all, and "pthread-config" -# which is a program returning the flags for the Pth emulation library. - -acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" - -# The ordering *is* (sometimes) important. Some notes on the -# individual items follow: - -# pthreads: AIX (must check this before -lpthread) -# none: in case threads are in libc; should be tried before -Kthread and -# other compiler flags to prevent continual compiler warnings -# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) -# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) -# -pthreads: Solaris/gcc -# -mthreads: Mingw32/gcc, Lynx/gcc -# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it -# doesn't hurt to check since this sometimes defines pthreads too; -# also defines -D_REENTRANT) -# ... -mt is also the pthreads flag for HP/aCC -# pthread: Linux, etcetera -# --thread-safe: KAI C++ -# pthread-config: use pthread-config program (for GNU Pth library) - -case "${host_cpu}-${host_os}" in - *solaris*) - - # On Solaris (at least, for some versions), libc contains stubbed - # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (We need to link with -pthreads/-mt/ - # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather - # a function called by this macro, so we could check for that, but - # who knows whether they'll stub that too in a future libc.) So, - # we'll just look for -pthreads and -lpthread first: - - acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" - ;; -esac - -if test x"$acx_pthread_ok" = xno; then -for flag in $acx_pthread_flags; do - - case $flag in - none) - AC_MSG_CHECKING([whether pthreads work without any flags]) - ;; - - -*) - AC_MSG_CHECKING([whether pthreads work with $flag]) - PTHREAD_CFLAGS="$flag" - ;; - - pthread-config) - AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) - if test x"$acx_pthread_config" = xno; then continue; fi - PTHREAD_CFLAGS="`pthread-config --cflags`" - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" - ;; - - *) - AC_MSG_CHECKING([for the pthreads library -l$flag]) - PTHREAD_LIBS="-l$flag" - ;; - esac - - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) - # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init - # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. - AC_TRY_LINK([#include ], - [pthread_t th; pthread_join(th, 0); - pthread_attr_init(0); pthread_cleanup_push(0, 0); - pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], - [acx_pthread_ok=yes]) - - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - - AC_MSG_RESULT($acx_pthread_ok) - if test "x$acx_pthread_ok" = xyes; then - break; - fi - - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" -done -fi - -# Various other checks: -if test "x$acx_pthread_ok" = xyes; then - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - - # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - AC_MSG_CHECKING([for joinable pthread attribute]) - attr_name=unknown - for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - AC_TRY_LINK([#include ], [int attr=$attr; return attr;], - [attr_name=$attr; break]) - done - AC_MSG_RESULT($attr_name) - if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then - AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, - [Define to necessary symbol if this constant - uses a non-standard name on your system.]) - fi - - AC_MSG_CHECKING([if more special flags are required for pthreads]) - flag=no - case "${host_cpu}-${host_os}" in - *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; - *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; - esac - AC_MSG_RESULT(${flag}) - if test "x$flag" != xno; then - PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" - fi - - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - # More AIX lossage: must compile with xlc_r or cc_r - if test x"$GCC" != xyes; then - AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) - else - PTHREAD_CC=$CC - fi - - # The next part tries to detect GCC inconsistency with -shared on some - # architectures and systems. The problem is that in certain - # configurations, when -shared is specified, GCC "forgets" to - # internally use various flags which are still necessary. - - # - # Prepare the flags - # - save_CFLAGS="$CFLAGS" - save_LIBS="$LIBS" - save_CC="$CC" - - # Try with the flags determined by the earlier checks. - # - # -Wl,-z,defs forces link-time symbol resolution, so that the - # linking checks with -shared actually have any value - # - # FIXME: -fPIC is required for -shared on many architectures, - # so we specify it here, but the right way would probably be to - # properly detect whether it is actually required. - CFLAGS="-shared -fPIC -Wl,-z,defs $CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - CC="$PTHREAD_CC" - - # In order not to create several levels of indentation, we test - # the value of "$done" until we find the cure or run out of ideas. - done="no" - - # First, make sure the CFLAGS we added are actually accepted by our - # compiler. If not (and OS X's ld, for instance, does not accept -z), - # then we can't do this test. - if test x"$done" = xno; then - AC_MSG_CHECKING([whether to check for GCC pthread/shared inconsistencies]) - AC_TRY_LINK(,, , [done=yes]) - - if test "x$done" = xyes ; then - AC_MSG_RESULT([no]) - else - AC_MSG_RESULT([yes]) - fi - fi - - if test x"$done" = xno; then - AC_MSG_CHECKING([whether -pthread is sufficient with -shared]) - AC_TRY_LINK([#include ], - [pthread_t th; pthread_join(th, 0); - pthread_attr_init(0); pthread_cleanup_push(0, 0); - pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], - [done=yes]) - - if test "x$done" = xyes; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - fi - - # - # Linux gcc on some architectures such as mips/mipsel forgets - # about -lpthread - # - if test x"$done" = xno; then - AC_MSG_CHECKING([whether -lpthread fixes that]) - LIBS="-lpthread $PTHREAD_LIBS $save_LIBS" - AC_TRY_LINK([#include ], - [pthread_t th; pthread_join(th, 0); - pthread_attr_init(0); pthread_cleanup_push(0, 0); - pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], - [done=yes]) - - if test "x$done" = xyes; then - AC_MSG_RESULT([yes]) - PTHREAD_LIBS="-lpthread $PTHREAD_LIBS" - else - AC_MSG_RESULT([no]) - fi - fi - # - # FreeBSD 4.10 gcc forgets to use -lc_r instead of -lc - # - if test x"$done" = xno; then - AC_MSG_CHECKING([whether -lc_r fixes that]) - LIBS="-lc_r $PTHREAD_LIBS $save_LIBS" - AC_TRY_LINK([#include ], - [pthread_t th; pthread_join(th, 0); - pthread_attr_init(0); pthread_cleanup_push(0, 0); - pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], - [done=yes]) - - if test "x$done" = xyes; then - AC_MSG_RESULT([yes]) - PTHREAD_LIBS="-lc_r $PTHREAD_LIBS" - else - AC_MSG_RESULT([no]) - fi - fi - if test x"$done" = xno; then - # OK, we have run out of ideas - AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries]) - - # so it's not safe to assume that we may use pthreads - acx_pthread_ok=no - fi - - CFLAGS="$save_CFLAGS" - LIBS="$save_LIBS" - CC="$save_CC" -else - PTHREAD_CC="$CC" -fi - -AC_SUBST(PTHREAD_LIBS) -AC_SUBST(PTHREAD_CFLAGS) -AC_SUBST(PTHREAD_CC) - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$acx_pthread_ok" = xyes; then - ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) - : -else - acx_pthread_ok=no - $2 -fi -AC_LANG_RESTORE -])dnl ACX_PTHREAD diff --git a/m4/google_namespace.m4 b/m4/google_namespace.m4 deleted file mode 100644 index 79e0a6d..0000000 --- a/m4/google_namespace.m4 +++ /dev/null @@ -1,36 +0,0 @@ -# Allow users to override the namespace we define our application's classes in -# Arg $1 is the default namespace to use if --enable-namespace isn't present. - -# In general, $1 should be 'google', so we put all our exported symbols in a -# unique namespace that is not likely to conflict with anyone else. However, -# when it makes sense -- for instance, when publishing stl-like code -- you -# may want to go with a different default, like 'std'. - -AC_DEFUN([AC_DEFINE_GOOGLE_NAMESPACE], - [google_namespace_default=[$1] - AC_ARG_ENABLE(namespace, [ --enable-namespace=FOO to define these Google - classes in the FOO namespace. --disable-namespace - to define them in the global namespace. Default - is to define them in namespace $1.], - [case "$enableval" in - yes) google_namespace="$google_namespace_default" ;; - no) google_namespace="" ;; - *) google_namespace="$enableval" ;; - esac], - [google_namespace="$google_namespace_default"]) - if test -n "$google_namespace"; then - ac_google_namespace="$google_namespace" - ac_google_start_namespace="namespace $google_namespace {" - ac_google_end_namespace="}" - else - ac_google_namespace="" - ac_google_start_namespace="" - ac_google_end_namespace="" - fi - AC_DEFINE_UNQUOTED(GOOGLE_NAMESPACE, $ac_google_namespace, - Namespace for Google classes) - AC_DEFINE_UNQUOTED(_START_GOOGLE_NAMESPACE_, $ac_google_start_namespace, - Puts following code inside the Google namespace) - AC_DEFINE_UNQUOTED(_END_GOOGLE_NAMESPACE_, $ac_google_end_namespace, - Stops putting the code inside the Google namespace) -]) diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4 deleted file mode 100644 index 9000a05..0000000 --- a/m4/ltsugar.m4 +++ /dev/null @@ -1,123 +0,0 @@ -# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 6 ltsugar.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) - - -# lt_join(SEP, ARG1, [ARG2...]) -# ----------------------------- -# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their -# associated separator. -# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier -# versions in m4sugar had bugs. -m4_define([lt_join], -[m4_if([$#], [1], [], - [$#], [2], [[$2]], - [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) -m4_define([_lt_join], -[m4_if([$#$2], [2], [], - [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) - - -# lt_car(LIST) -# lt_cdr(LIST) -# ------------ -# Manipulate m4 lists. -# These macros are necessary as long as will still need to support -# Autoconf-2.59 which quotes differently. -m4_define([lt_car], [[$1]]) -m4_define([lt_cdr], -[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], - [$#], 1, [], - [m4_dquote(m4_shift($@))])]) -m4_define([lt_unquote], $1) - - -# lt_append(MACRO-NAME, STRING, [SEPARATOR]) -# ------------------------------------------ -# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. -# Note that neither SEPARATOR nor STRING are expanded; they are appended -# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). -# No SEPARATOR is output if MACRO-NAME was previously undefined (different -# than defined and empty). -# -# This macro is needed until we can rely on Autoconf 2.62, since earlier -# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. -m4_define([lt_append], -[m4_define([$1], - m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) - - - -# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) -# ---------------------------------------------------------- -# Produce a SEP delimited list of all paired combinations of elements of -# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list -# has the form PREFIXmINFIXSUFFIXn. -# Needed until we can rely on m4_combine added in Autoconf 2.62. -m4_define([lt_combine], -[m4_if(m4_eval([$# > 3]), [1], - [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl -[[m4_foreach([_Lt_prefix], [$2], - [m4_foreach([_Lt_suffix], - ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, - [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) - - -# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) -# ----------------------------------------------------------------------- -# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited -# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. -m4_define([lt_if_append_uniq], -[m4_ifdef([$1], - [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], - [lt_append([$1], [$2], [$3])$4], - [$5])], - [lt_append([$1], [$2], [$3])$4])]) - - -# lt_dict_add(DICT, KEY, VALUE) -# ----------------------------- -m4_define([lt_dict_add], -[m4_define([$1($2)], [$3])]) - - -# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) -# -------------------------------------------- -m4_define([lt_dict_add_subkey], -[m4_define([$1($2:$3)], [$4])]) - - -# lt_dict_fetch(DICT, KEY, [SUBKEY]) -# ---------------------------------- -m4_define([lt_dict_fetch], -[m4_ifval([$3], - m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), - m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) - - -# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) -# ----------------------------------------------------------------- -m4_define([lt_if_dict_fetch], -[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], - [$5], - [$6])]) - - -# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) -# -------------------------------------------------------------- -m4_define([lt_dict_filter], -[m4_if([$5], [], [], - [lt_join(m4_quote(m4_default([$4], [[, ]])), - lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), - [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl -]) diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4 deleted file mode 100644 index c573da9..0000000 --- a/m4/lt~obsolete.m4 +++ /dev/null @@ -1,98 +0,0 @@ -# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004. -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 5 lt~obsolete.m4 - -# These exist entirely to fool aclocal when bootstrapping libtool. -# -# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) -# which have later been changed to m4_define as they aren't part of the -# exported API, or moved to Autoconf or Automake where they belong. -# -# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN -# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us -# using a macro with the same name in our local m4/libtool.m4 it'll -# pull the old libtool.m4 in (it doesn't see our shiny new m4_define -# and doesn't know about Autoconf macros at all.) -# -# So we provide this file, which has a silly filename so it's always -# included after everything else. This provides aclocal with the -# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything -# because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. -# -# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. -# Yes, that means every name once taken will need to remain here until -# we give up compatibility with versions before 1.7, at which point -# we need to keep only those names which we still refer to. - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) - -m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) -m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) -m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) -m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) -m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) -m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) -m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) -m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) -m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) -m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) -m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) -m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) -m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) -m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) -m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) -m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) -m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) -m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) -m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) -m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) -m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) -m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) -m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) -m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) -m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) -m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) -m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) -m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) -m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) -m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) -m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) -m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) -m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) -m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) -m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) -m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) -m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) -m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) -m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) -m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) -m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) -m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) -m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) -m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) -m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) -m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) -m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) -m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) -m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/m4/namespaces.m4 b/m4/namespaces.m4 deleted file mode 100644 index d78dbe4..0000000 --- a/m4/namespaces.m4 +++ /dev/null @@ -1,15 +0,0 @@ -# Checks whether the compiler implements namespaces -AC_DEFUN([AC_CXX_NAMESPACES], - [AC_CACHE_CHECK(whether the compiler implements namespaces, - ac_cv_cxx_namespaces, - [AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([namespace Outer { - namespace Inner { int i = 0; }}], - [using namespace Outer::Inner; return i;], - ac_cv_cxx_namespaces=yes, - ac_cv_cxx_namespaces=no) - AC_LANG_RESTORE]) - if test "$ac_cv_cxx_namespaces" = yes; then - AC_DEFINE(HAVE_NAMESPACES, 1, [define if the compiler implements namespaces]) - fi]) diff --git a/m4/pc_from_ucontext.m4 b/m4/pc_from_ucontext.m4 deleted file mode 100644 index daffddb..0000000 --- a/m4/pc_from_ucontext.m4 +++ /dev/null @@ -1,71 +0,0 @@ -# We want to access the "PC" (Program Counter) register from a struct -# ucontext. Every system has its own way of doing that. We try all the -# possibilities we know about. Note REG_PC should come first (REG_RIP -# is also defined on solaris, but does the wrong thing). - -# OpenBSD doesn't have ucontext.h, but we can get PC from ucontext_t -# by using signal.h. - -# The first argument of AC_PC_FROM_UCONTEXT will be invoked when we -# cannot find a way to obtain PC from ucontext. - -AC_DEFUN([AC_PC_FROM_UCONTEXT], - [AC_CHECK_HEADERS(ucontext.h) - AC_CHECK_HEADERS(sys/ucontext.h) # ucontext on OS X 10.6 (at least) - AC_MSG_CHECKING([how to access the program counter from a struct ucontext]) - pc_fields=" uc_mcontext.gregs[[REG_PC]]" # Solaris x86 (32 + 64 bit) - pc_fields="$pc_fields uc_mcontext.gregs[[REG_EIP]]" # Linux (i386) - pc_fields="$pc_fields uc_mcontext.gregs[[REG_RIP]]" # Linux (x86_64) - pc_fields="$pc_fields uc_mcontext.sc_ip" # Linux (ia64) - pc_fields="$pc_fields uc_mcontext.uc_regs->gregs[[PT_NIP]]" # Linux (ppc) - pc_fields="$pc_fields uc_mcontext.gregs[[R15]]" # Linux (arm old [untested]) - pc_fields="$pc_fields uc_mcontext.arm_pc" # Linux (arm new [untested]) - pc_fields="$pc_fields uc_mcontext.mc_eip" # FreeBSD (i386) - pc_fields="$pc_fields uc_mcontext.mc_rip" # FreeBSD (x86_64 [untested]) - pc_fields="$pc_fields uc_mcontext.__gregs[[_REG_EIP]]" # NetBSD (i386) - pc_fields="$pc_fields uc_mcontext.__gregs[[_REG_RIP]]" # NetBSD (x86_64) - pc_fields="$pc_fields uc_mcontext->ss.eip" # OS X (i386, <=10.4) - pc_fields="$pc_fields uc_mcontext->__ss.__eip" # OS X (i386, >=10.5) - pc_fields="$pc_fields uc_mcontext->ss.rip" # OS X (x86_64) - pc_fields="$pc_fields uc_mcontext->__ss.__rip" # OS X (>=10.5 [untested]) - pc_fields="$pc_fields uc_mcontext->ss.srr0" # OS X (ppc, ppc64 [untested]) - pc_fields="$pc_fields uc_mcontext->__ss.__srr0" # OS X (>=10.5 [untested]) - pc_field_found=false - for pc_field in $pc_fields; do - if ! $pc_field_found; then - if test "x$ac_cv_header_sys_ucontext_h" = xyes; then - AC_TRY_COMPILE([#define _GNU_SOURCE 1 - #include ], - [ucontext_t u; return u.$pc_field == 0;], - AC_DEFINE_UNQUOTED(PC_FROM_UCONTEXT, $pc_field, - How to access the PC from a struct ucontext) - AC_MSG_RESULT([$pc_field]) - pc_field_found=true) - else - AC_TRY_COMPILE([#define _GNU_SOURCE 1 - #include ], - [ucontext_t u; return u.$pc_field == 0;], - AC_DEFINE_UNQUOTED(PC_FROM_UCONTEXT, $pc_field, - How to access the PC from a struct ucontext) - AC_MSG_RESULT([$pc_field]) - pc_field_found=true) - fi - fi - done - if ! $pc_field_found; then - pc_fields=" sc_eip" # OpenBSD (i386) - pc_fields="$pc_fields sc_rip" # OpenBSD (x86_64) - for pc_field in $pc_fields; do - if ! $pc_field_found; then - AC_TRY_COMPILE([#include ], - [ucontext_t u; return u.$pc_field == 0;], - AC_DEFINE_UNQUOTED(PC_FROM_UCONTEXT, $pc_field, - How to access the PC from a struct ucontext) - AC_MSG_RESULT([$pc_field]) - pc_field_found=true) - fi - done - fi - if ! $pc_field_found; then - [$1] - fi]) diff --git a/m4/stl_namespace.m4 b/m4/stl_namespace.m4 deleted file mode 100644 index 989ad80..0000000 --- a/m4/stl_namespace.m4 +++ /dev/null @@ -1,25 +0,0 @@ -# We check what namespace stl code like vector expects to be executed in - -AC_DEFUN([AC_CXX_STL_NAMESPACE], - [AC_CACHE_CHECK( - what namespace STL code is in, - ac_cv_cxx_stl_namespace, - [AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include ], - [vector t; return 0;], - ac_cv_cxx_stl_namespace=none) - AC_TRY_COMPILE([#include ], - [std::vector t; return 0;], - ac_cv_cxx_stl_namespace=std) - AC_LANG_RESTORE]) - if test "$ac_cv_cxx_stl_namespace" = none; then - AC_DEFINE(STL_NAMESPACE,, - [the namespace where STL code like vector<> is defined]) - fi - if test "$ac_cv_cxx_stl_namespace" = std; then - AC_DEFINE(STL_NAMESPACE,std, - [the namespace where STL code like vector<> is defined]) - fi -]) diff --git a/m4/using_operator.m4 b/m4/using_operator.m4 deleted file mode 100644 index 95a9951..0000000 --- a/m4/using_operator.m4 +++ /dev/null @@ -1,15 +0,0 @@ -AC_DEFUN([AC_CXX_USING_OPERATOR], - [AC_CACHE_CHECK( - whether compiler supports using ::operator<<, - ac_cv_cxx_using_operator, - [AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include - std::ostream& operator<<(std::ostream&, struct s);], - [using ::operator<<; return 0;], - ac_cv_cxx_using_operator=1, - ac_cv_cxx_using_operator=0) - AC_LANG_RESTORE]) - if test "$ac_cv_cxx_using_operator" = 1; then - AC_DEFINE(HAVE_USING_OPERATOR, 1, [define if the compiler supports using expression for operator]) - fi]) diff --git a/packages/deb.sh b/packages/deb.sh deleted file mode 100755 index a1cdf32..0000000 --- a/packages/deb.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -e - -# This takes one commandline argument, the name of the package. If no -# name is given, then we'll end up just using the name associated with -# an arbitrary .tar.gz file in the rootdir. That's fine: there's probably -# only one. -# -# Run this from the 'packages' directory, just under rootdir - -## Set LIB to lib if exporting a library, empty-string else -LIB= -#LIB=lib - -PACKAGE="$1" -VERSION="$2" - -# We can only build Debian packages, if the Debian build tools are installed -if [ \! -x /usr/bin/debuild ]; then - echo "Cannot find /usr/bin/debuild. Not building Debian packages." 1>&2 - exit 0 -fi - -# Double-check we're in the packages directory, just under rootdir -if [ \! -r ../Makefile -a \! -r ../INSTALL ]; then - echo "Must run $0 in the 'packages' directory, under the root directory." 1>&2 - echo "Also, you must run \"make dist\" before running this script." 1>&2 - exit 0 -fi - -# Find the top directory for this package -topdir="${PWD%/*}" - -# Find the tar archive built by "make dist" -archive="$PACKAGE-$VERSION" -if [ -z "${archive}" ]; then - echo "Cannot find ../$PACKAGE*.tar.gz. Run \"make dist\" first." 1>&2 - exit 0 -fi - -# Create a pristine directory for building the Debian package files -trap 'rm -rf '`pwd`/tmp'; exit $?' EXIT SIGHUP SIGINT SIGTERM - -rm -rf tmp -mkdir -p tmp -cd tmp - -package="google-glog_$VERSION" - -# Debian has very specific requirements about the naming of build -# directories, and tar archives. It also wants to write all generated -# packages to the parent of the source directory. We accommodate these -# requirements by building directly from the tar file. -ln -s "${topdir}/${archive}.tar.gz" "${LIB}${package}.orig.tar.gz" -tar zfx "${LIB}${package}.orig.tar.gz" -mv "${archive}" "${LIB}${package}" -cd "${LIB}${package}" -# This is one of those 'specific requirements': where the deb control files live -cp -a "packages/deb" "debian" - -# Now, we can call Debian's standard build tool -debuild -uc -us -cd ../.. # get back to the original top-level dir - -# We'll put the result in a subdirectory that's named after the OS version -# we've made this .deb file for. -destdir="debian-$(cat /etc/debian_version 2>/dev/null || echo UNKNOWN)" - -rm -rf "$destdir" -mkdir -p "$destdir" -mv $(find tmp -mindepth 1 -maxdepth 1 -type f) "$destdir" - -echo -echo "The Debian package files are located in $PWD/$destdir" diff --git a/packages/deb/README b/packages/deb/README deleted file mode 100644 index 57becfd..0000000 --- a/packages/deb/README +++ /dev/null @@ -1,7 +0,0 @@ -The list of files here isn't complete. For a step-by-step guide on -how to set this package up correctly, check out - http://www.debian.org/doc/maint-guide/ - -Most of the files that are in this directory are boilerplate. -However, you may need to change the list of binary-arch dependencies -in 'rules'. diff --git a/packages/deb/changelog b/packages/deb/changelog deleted file mode 100644 index 4cbed1b..0000000 --- a/packages/deb/changelog +++ /dev/null @@ -1,71 +0,0 @@ -google-glog (0.4.0-1) unstable; urgency=low - - * New upstream release. - - -- Google Inc. Tue, 22 Jan 2019 21:00:26 +0900 - -google-glog (0.3.5-1) unstable; urgency=low - - * New upstream release. - - -- Google Inc. Tue, 09 May 2017 16:22:12 +0900 - -google-glog (0.3.4-1) unstable; urgency=low - - * New upstream release. - - -- Google Inc. Tue, 10 Mar 2015 12:02:20 +0900 - -google-glog (0.3.3-1) unstable; urgency=low - - * New upstream release. - - -- Google Inc. Fri, 01 Feb 2012 14:54:14 +0900 - -google-glog (0.3.2-1) unstable; urgency=low - - * New upstream release. - - -- Google Inc. Thu, 12 Jan 2012 17:36:14 +0900 - -google-glog (0.3.1-1) unstable; urgency=low - - * New upstream release. - - -- Google Inc. Tue, 15 Jun 2010 13:50:47 +0900 - -google-glog (0.3-1) unstable; urgency=low - - * New upstream release. - - -- Google Inc. Thu, 30 Jul 2009 21:31:35 +0900 - -google-glog (0.2.1-1) unstable; urgency=low - - * New upstream release. - - -- Google Inc. Fri, 10 Apr 2009 15:24:17 +0900 - -google-glog (0.2-1) unstable; urgency=low - - * New upstream release. - - -- Google Inc. Fri, 23 Jan 2009 03:14:29 +0900 - -google-glog (0.1.2-1) unstable; urgency=low - - * New upstream release. - - -- Google Inc. Tue, 18 Nov 2008 20:37:00 +0900 - -google-glog (0.1.1-1) unstable; urgency=low - - * New upstream release. - - -- Google Inc. Wed, 15 Oct 2008 20:38:19 +0900 - -google-glog (0.1-1) unstable; urgency=low - - * Initial release. - - -- Google Inc. Sat, 10 May 2008 12:31:10 +0900 diff --git a/packages/deb/compat b/packages/deb/compat deleted file mode 100644 index b8626c4..0000000 --- a/packages/deb/compat +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/packages/deb/control b/packages/deb/control deleted file mode 100644 index 110a72c..0000000 --- a/packages/deb/control +++ /dev/null @@ -1,23 +0,0 @@ -Source: google-glog -Priority: optional -Maintainer: Google Inc. -Build-Depends: debhelper (>= 4.0.0), binutils -Standards-Version: 3.6.1 - -Package: libgoogle-glog-dev -Section: libdevel -Architecture: any -Depends: libgoogle-glog0 (= ${Source-Version}) -Description: a library that implements application-level logging. - This library provides logging APIs based on C++-style streams and - various helper macros. The devel package contains static and debug - libraries and header files for developing applications that use the - google-glog package. - -Package: libgoogle-glog0 -Section: libs -Architecture: any -Depends: ${shlibs:Depends} -Description: a library that implements application-level logging. - This library provides logging APIs based on C++-style streams and - various helper macros. diff --git a/packages/deb/copyright b/packages/deb/copyright deleted file mode 100644 index b2ce8e8..0000000 --- a/packages/deb/copyright +++ /dev/null @@ -1,35 +0,0 @@ -This package was debianized by Google Inc. on -13 June 2008. - -It was downloaded from https://github.com/google/glog - -Upstream Author: opensource@google.com - -Copyright (c) 2008, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/deb/docs b/packages/deb/docs deleted file mode 100644 index 6da25d4..0000000 --- a/packages/deb/docs +++ /dev/null @@ -1,7 +0,0 @@ -AUTHORS -COPYING -ChangeLog -INSTALL -README.md -doc/designstyle.css -doc/glog.html diff --git a/packages/deb/libgoogle-glog-dev.dirs b/packages/deb/libgoogle-glog-dev.dirs deleted file mode 100644 index bddfbf5..0000000 --- a/packages/deb/libgoogle-glog-dev.dirs +++ /dev/null @@ -1,4 +0,0 @@ -usr/lib -usr/lib/pkgconfig -usr/include -usr/include/glog diff --git a/packages/deb/libgoogle-glog-dev.install b/packages/deb/libgoogle-glog-dev.install deleted file mode 100644 index 9c61e86..0000000 --- a/packages/deb/libgoogle-glog-dev.install +++ /dev/null @@ -1,10 +0,0 @@ -usr/include/glog/* -usr/lib/lib*.so -usr/lib/lib*.a -usr/lib/*.la -usr/lib/pkgconfig/* -debian/tmp/usr/include/glog/* -debian/tmp/usr/lib/lib*.so -debian/tmp/usr/lib/lib*.a -debian/tmp/usr/lib/*.la -debian/tmp/usr/lib/pkgconfig/* diff --git a/packages/deb/libgoogle-glog0.dirs b/packages/deb/libgoogle-glog0.dirs deleted file mode 100644 index 6845771..0000000 --- a/packages/deb/libgoogle-glog0.dirs +++ /dev/null @@ -1 +0,0 @@ -usr/lib diff --git a/packages/deb/libgoogle-glog0.install b/packages/deb/libgoogle-glog0.install deleted file mode 100644 index 704ea87..0000000 --- a/packages/deb/libgoogle-glog0.install +++ /dev/null @@ -1,2 +0,0 @@ -usr/lib/lib*.so.* -debian/tmp/usr/lib/lib*.so.* diff --git a/packages/deb/rules b/packages/deb/rules deleted file mode 100755 index f520bef..0000000 --- a/packages/deb/rules +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - - -# These are used for cross-compiling and for saving the configure script -# from having to guess our platform (since we know it already) -DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) - - -CFLAGS = -Wall -g - -ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) - CFLAGS += -O0 -else - CFLAGS += -O2 -endif -ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) - INSTALL_PROGRAM += -s -endif - -# shared library versions, option 1 -#version=2.0.5 -#major=2 -# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so -version=`ls src/.libs/lib*.so.* | \ - awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'` -major=`ls src/.libs/lib*.so.* | \ - awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'` - -config.status: configure - dh_testdir - # Add here commands to configure the package. - CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info - - -build: build-stamp -build-stamp: config.status - dh_testdir - - # Add here commands to compile the package. - $(MAKE) - - touch build-stamp - -clean: - dh_testdir - dh_testroot - rm -f build-stamp - - # Add here commands to clean up after the build process. - -$(MAKE) distclean -ifneq "$(wildcard /usr/share/misc/config.sub)" "" - cp -f /usr/share/misc/config.sub config.sub -endif -ifneq "$(wildcard /usr/share/misc/config.guess)" "" - cp -f /usr/share/misc/config.guess config.guess -endif - - - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - # Add here commands to install the package into debian/tmp - $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp - - -# Build architecture-independent files here. -binary-indep: build install -# We have nothing to do by default. - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir - dh_testroot - dh_installchangelogs ChangeLog - dh_installdocs - dh_installexamples - dh_install --sourcedir=debian/tmp -# dh_installmenu -# dh_installdebconf -# dh_installlogrotate -# dh_installemacsen -# dh_installpam -# dh_installmime -# dh_installinit -# dh_installcron -# dh_installinfo - dh_installman - dh_link - dh_strip - dh_compress - dh_fixperms -# dh_perl -# dh_python - dh_makeshlibs - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install diff --git a/packages/rpm.sh b/packages/rpm.sh deleted file mode 100755 index e5649a2..0000000 --- a/packages/rpm.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/sh -e - -# Run this from the 'packages' directory, just under rootdir - -# We can only build rpm packages, if the rpm build tools are installed -if [ \! -x /usr/bin/rpmbuild ] -then - echo "Cannot find /usr/bin/rpmbuild. Not building an rpm." 1>&2 - exit 0 -fi - -# Check the commandline flags -PACKAGE="$1" -VERSION="$2" -fullname="${PACKAGE}-${VERSION}" -archive=../$fullname.tar.gz - -if [ -z "$1" -o -z "$2" ] -then - echo "Usage: $0 " 1>&2 - exit 0 -fi - -# Double-check we're in the packages directory, just under rootdir -if [ \! -r ../Makefile -a \! -r ../INSTALL ] -then - echo "Must run $0 in the 'packages' directory, under the root directory." 1>&2 - echo "Also, you must run \"make dist\" before running this script." 1>&2 - exit 0 -fi - -if [ \! -r "$archive" ] -then - echo "Cannot find $archive. Run \"make dist\" first." 1>&2 - exit 0 -fi - -# Create the directory where the input lives, and where the output should live -RPM_SOURCE_DIR="/tmp/rpmsource-$fullname" -RPM_BUILD_DIR="/tmp/rpmbuild-$fullname" - -trap 'rm -rf $RPM_SOURCE_DIR $RPM_BUILD_DIR; exit $?' EXIT SIGHUP SIGINT SIGTERM - -rm -rf "$RPM_SOURCE_DIR" "$RPM_BUILD_DIR" -mkdir "$RPM_SOURCE_DIR" -mkdir "$RPM_BUILD_DIR" - -cp "$archive" "$RPM_SOURCE_DIR"/v"$VERSION".tar.gz - -rpmbuild -bb rpm/rpm.spec \ - --define "NAME $PACKAGE" \ - --define "VERSION $VERSION" \ - --define "_sourcedir $RPM_SOURCE_DIR" \ - --define "_builddir $RPM_BUILD_DIR" \ - --define "_rpmdir $RPM_SOURCE_DIR" - -# We put the output in a directory based on what system we've built for -destdir=rpm-unknown -if [ -r /etc/issue ] -then - grep "Red Hat.*release 7" /etc/issue >/dev/null 2>&1 && destdir=rh7 - grep "Red Hat.*release 8" /etc/issue >/dev/null 2>&1 && destdir=rh8 - grep "Red Hat.*release 9" /etc/issue >/dev/null 2>&1 && destdir=rh9 - if grep Fedora /etc/issue >/dev/null; then - destdir=fc`grep Fedora /etc/issue | cut -d' ' -f 4`; - fi -fi - -rm -rf "$destdir" -mkdir -p "$destdir" -# We want to get not only the main package but devel etc, hence the middle * -mv "$RPM_SOURCE_DIR"/*/"${PACKAGE}"-*"${VERSION}"*.rpm "$destdir" - -echo -echo "The rpm package file(s) are located in $PWD/$destdir" diff --git a/packages/rpm/rpm.spec b/packages/rpm/rpm.spec deleted file mode 100644 index 24ef134..0000000 --- a/packages/rpm/rpm.spec +++ /dev/null @@ -1,72 +0,0 @@ -%define RELEASE 1 -%define rel %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE} -%define prefix /usr - -Name: %NAME -Summary: A C++ application logging library -Version: %VERSION -Release: %rel -Group: Development/Libraries -URL: http://github.com/google/glog -License: BSD -Vendor: Google -Packager: Google Inc. -Source: https://github.com/google/glog/archive/v%{VERSION}.tar.gz -Distribution: Redhat 7 and above. -Buildroot: %{_tmppath}/%{name}-root -Prefix: %prefix - -%description -The %name package contains a library that implements application-level -logging. This library provides logging APIs based on C++-style -streams and various helper macros. - -%package devel -Summary: A C++ application logging library -Group: Development/Libraries -Requires: %{NAME} = %{VERSION} - -%description devel -The %name-devel package contains static and debug libraries and header -files for developing applications that use the %name package. - -%changelog - * Wed Mar 26 2008 - - First draft - -%prep -%setup - -%build -./configure -make prefix=%prefix - -%install -rm -rf $RPM_BUILD_ROOT -make prefix=$RPM_BUILD_ROOT%{prefix} install - -%clean -rm -rf $RPM_BUILD_ROOT - -%files -%defattr(-,root,root) - -## Mark all installed files within /usr/share/doc/{package name} as -## documentation. This depends on the following two lines appearing in -## Makefile.am: -## docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION) -## dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL README.md -%docdir %{prefix}/share/doc/%{NAME}-%{VERSION} -%{prefix}/share/doc/%{NAME}-%{VERSION}/* - -%{prefix}/lib/libglog.so.0 -%{prefix}/lib/libglog.so.0.0.0 - -%files devel -%defattr(-,root,root) - -%{prefix}/include/glog -%{prefix}/lib/libglog.a -%{prefix}/lib/libglog.la -%{prefix}/lib/libglog.so -%{prefix}/lib/pkgconfig/libglog.pc

Introduction