Commit Graph

339 Commits

Author SHA1 Message Date
z-aki
4a4331f2f2 Fix syscall deprecation warning on macOS >= 10.12
Fix #185
2021-07-14 19:51:19 +05:30
Sergiu Deitsch
c39fcf6e8a ci: added more targets 2021-07-14 02:21:58 +02:00
Dmitriy A
a1374c4200 Implement LOG_EVERY_T.
Use <chrono> and <atomic> for C++11 or greater.
For non-Windows pre-C++11 systems, use <time.h> and built-in atomic operations.
For Windows pre-C++11, use the Windows implementations for time and atomic operations.
2021-07-05 07:25:12 -07:00
Sergiu Deitsch
d25a1b7bc0 cmake: export <atomic> availability (fixes #667) 2021-06-15 18:36:24 +02:00
Roman Gershman
86fea1ab25 Allow updating vmodule levels after vmodule was parsed, invalidate already cached site flags
vmodule flag is relevant for GNUC environments only.
2021-05-23 19:38:22 +03:00
Tongliang Liao
81e0d616ed Expose IsGoogleLoggingInitialized() in public API.
Usually library does not have control of the process lifespan.
Without this function, it is impossible to init/shutdown reliably.
It has been one of the major pain points for years when using glog in libraries.

AFAIK 3 workarounds have been used previously:
1. Init without checking. This causes compatiblity issues with other libs using glog.
2. Also provide a init function in library's API. This makes API complicated and stateful, especially for libs that does not mean to stay for the entire life of process.
3. Steal the utility function in internal namespace. Does not work with msvc (due to missing dllexport) or `gcc -fvisibility=hidden`.

None of them are perfect, except for the last hack that usually works well on Linux.
0.5.0 changes default visibility to hidden and it does not work anymore.

Resolve https://github.com/google/glog/issues/125
2021-05-14 08:57:32 +08:00
Sergiu Deitsch
0efaa59a75
Merge pull request #641 from sergiud/nullptr
CHECK support for nullptr (fixes #341)
2021-04-12 10:08:28 +02:00
Sergiu Deitsch
230da316c5
Merge pull request #637 from xiaobfly/master
fix LogCleaner::IsLogFromCurrentProject for filename_extension
2021-04-11 15:20:57 +02:00
Sergiu Deitsch
762a2a7ee1 eliminated gflags related linker warnings (#569) 2021-04-11 14:24:41 +02:00
Santiago Gil
0cbc235297 Add support for setting a custom prefix format 2021-04-09 20:11:44 +02:00
Bret McKee
c7656c3ec1 CHECK support for nullptr (fixes #341)
This allows CHECK_NE(foo, nullptr) to compile and produces "nullptr" for the
string representation of nullptr.
2021-04-09 20:10:08 +02:00
Sergiu Deitsch
663bb26960
Merge pull request #620 from sergiud/cmake-allow-to-disable-symbolize
cmake: allow to disable symbolize
2021-04-09 15:06:36 +02:00
Sergiu Deitsch
efc341d768 fixed windows builds 2021-04-08 18:16:42 +02:00
Sergiu Deitsch
39e83581de cmake: allow to disable symbolize 2021-04-07 22:59:46 +02:00
xiaobfly
635a078180 fix LogCleaner::IsLogFromCurrentProject for filename_extension 2021-04-07 17:42:52 +08:00
Sergiu Deitsch
7d60d6e04b removed windows specific headers 2021-04-06 19:59:47 +02:00
xiaobfly
4fca1b9673 fixed filename extension 2021-04-01 17:21:19 +08:00
Sergiu Deitsch
7f8a48b3bf
Merge pull request #595 from r-barnes/richard/ctr_type_fix
Change counter type to uint64
2021-03-31 09:43:14 +02:00
Richard Barnes
bf3e5a80ae Change counter type to uint64 2021-03-31 02:28:29 +02:00
Sergiu Deitsch
01f3e543e3 use C++ headers 2021-03-31 02:24:22 +02:00
Sergiu Deitsch
7a6e743eb6
Merge pull request #624 from sergiud/qualify-std-string
fully qualify std::string
2021-03-31 00:45:25 +02:00
Sergiu Deitsch
0b3c27d042 fully qualify std::string 2021-03-30 23:47:48 +02:00
Sergiu Deitsch
3533c22d21 handle --max_log_size overflow 2021-03-30 23:16:40 +02:00
Sergiu Deitsch
c30896d3d5 cmake: export symbols selectively 2021-03-30 21:41:52 +02:00
Marco
9881ea5969
Fix race conditions in LOG_EVERY_N (#492)
* Use CMakeLists.txt to check the availability of std::atomic<>
* Declare the static integer counters as std::atomic<int> instead of int if C++11's atomic is available
* implement fallback mechanism for pre C++11 compilers
* src/glog/logging.h.in: fix wrong atomic increment
* src/glog/logging.h.in: make modulo operations atomic
2021-02-22 22:17:25 +01:00
Sergiu Deitsch
795384957d replaced __CYGWIN32__ and __CYGWIN64__ by __CYGWIN__ 2021-02-13 14:52:26 +01:00
Sergiu Deitsch
4fa737b62a
Merge pull request #400 from guoyuhong/fixWebmailer
Fix logmailer problem for dynamic lib use of glog.
2021-02-13 11:57:07 +01:00
Sergiu Deitsch
4f09bed0b4
Merge pull request #263 from kennyyu/tsan_benign_race
Annotate LOG_EVERY_N macros as a benign race for TSAN
2021-02-13 11:55:42 +01:00
Sergiu Deitsch
7bba6030c2
Merge pull request #592 from aesophor/fix-logcleaner-file-ext
src/logging.cc: Make LogCleaner aware of filename extension (#589)
2021-02-13 11:48:23 +01:00
Sergiu Deitsch
7a8b66aa17
Merge pull request #593 from aesophor/fix-typo
src/logging.cc: Fix a typo in comment
2021-02-13 11:46:55 +01:00
Hill Ma
15d51a17cc Make stl_logging_unittest more robust. 2021-02-08 21:16:29 -08:00
Marco Wang
fe1287dd5d src/logging.cc: Fix a typo in comment
Signed-off-by: Marco Wang <m.aesophor@gmail.com>
2020-10-10 00:06:11 +08:00
Marco Wang
431d74c802 src/logging.cc: Make LogCleaner aware of filename extension (#589)
Previously, LogCleaner::IsLogFromCurrentProject() did not consider
the custom file extension set with SetLogFilenameExtension().

This PR fixes it.

Signed-off-by: Marco Wang <m.aesophor@gmail.com>
2020-10-09 22:40:12 +08:00
Marco
d82641f709
Merge branch 'master' into encapsulate-log-cleaner 2020-10-03 09:52:23 +08:00
Sergiu Deitsch
cec37e1cf5
Merge pull request #542 from xulongwu4/master
Use NULL to indicate uninitialized VLOG_IS_ON site.
2020-10-03 01:12:22 +02:00
Yuhong Guo
b55437ac10 Fix logmailer problem for dynamic lib. 2020-10-03 01:01:05 +02:00
Sergiu Deitsch
c5dcae8306
Merge pull request #467 from sukill/master
declare FLAGS_vmodule
2020-10-03 00:58:19 +02:00
Victor Costan
6c0a5fcb53 Fix unused parameter warning on gcc. 2020-09-30 00:53:10 -07:00
Sergiu Deitsch
f28ae960c3
Merge pull request #573 from msamoila/msamoila-use-utc-time
Add FLAGS_log_utc_time; when 'true' the time will be written in log in UTC, resolves #571
2020-09-29 22:25:02 +02:00
Sergiu Deitsch
fa0d50f9fc
Merge pull request #570 from jiuqiant/patch-1
Connect glog to Andorid logging API
2020-09-29 22:22:12 +02:00
Sergiu Deitsch
fcc9da24a6
Merge pull request #545 from julianaito/master
OpenBSD/powerpc: clang does not define _CALL_*, use proper ifdef instead
2020-09-29 22:19:20 +02:00
Sergiu Deitsch
40ab822812
Merge pull request #438 from d-uspenskiy/master
Add extra information in log file header (application build/version, actual duration time)
2020-09-29 22:18:24 +02:00
Sergiu Deitsch
4c5a60c3c3
Merge pull request #551 from aesophor/replace-sprintf
Replace sprintf() with snprintf() (#536)
2020-09-29 22:12:45 +02:00
Sergiu Deitsch
8ee2bb5b31
Merge pull request #553 from huangqinjin/android
Output to logcat on Android
2020-09-29 22:11:54 +02:00
Sergiu Deitsch
024b095d7e
Merge pull request #552 from huangqinjin/master
Make message text null-terminated
2020-09-29 22:11:22 +02:00
Sergiu Deitsch
d442460690
Merge pull request #579 from arj-fb/safety_check_at_SymbolizeAndDemangle
Added check for if info.dli_sname is NULL
2020-09-29 22:10:08 +02:00
Santiago Gil
7258189847 Add override to LogStreamBuf::overflow()
Prevents warnings such as:
```
glog/logging.h:1122:20: error: ‘virtual
std::basic_streambuf<char>::int_type
google::base_logging::LogStreamBuf::overflow(std::basic_streambuf<char>::int_type)’
can be marked override [-Werror=suggest-override]
   virtual int_type overflow(int_type ch) {
                    ^~~~~~~~
```

Signed-off-by: Santiago Gil <santiago.gil@codethink.co.uk>
2020-09-24 10:48:00 +01:00
Arjun Moudgil
e5ef2728bd 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.
2020-09-15 20:46:35 -04:00
M Samoila
909069ea82 Add FLAGS_log_utc_time; when 'true' the time will be written in log in UTC 2020-09-01 10:55:53 -07:00
Jiuqiang Tang
64650ef2ed
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.
2020-08-21 20:24:00 -07:00