Commit Graph

600 Commits

Author SHA1 Message Date
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
Yicong Huang
c652590d84
Update CMakeLists.txt
wrap the path with double quotation so that it can build on path with spaces.
2020-09-15 22:22:13 -07: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
Phillipp Schoppmann
0a2e5931bd
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.
2020-05-13 09:36:55 +09:00
huangqinjin
0a12a96cee Output to logcat on Android 2020-05-11 23:59:00 +08:00
huangqinjin
d8998fe4f6 Make message text null-terminated 2020-05-11 22:33:17 +08:00
Marco Wang
2e87f98fe4 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.
2020-05-08 14:50:55 +08:00
Charlène Wendling
7001ab9ecb 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.
2020-04-27 15:50:32 +02:00
Longwu Ou
4a82a856d2 Use NULL to indicate uninitialized VLOG_IS_ON site. 2020-04-26 22:57:58 -04:00
Doug Rabson
3ba8976592 fix bazel build for freebsd 2020-03-25 10:17:39 +01:00
Dmitry Uspenskiy
ceb7163880 Add extra information in log file header (application build/version, actual duration time) 2020-03-25 09:55:32 +01:00
Sergiu Deitsch
28321d8959
Merge pull request #503 from alexsmac/fix-custom-logger-deletion
Fix missing deletion of custom Logger
2020-03-25 09:52:26 +01:00
Marco
5b4fb63d27
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.
2020-03-25 09:36:28 +01:00
Sergiu Deitsch
7da49d48a3
Merge pull request #515 from segfaulthunter/doc
Explain log levels.
2020-03-25 09:10:52 +01:00
Lily
940335d82f
Add vcpkg installation instructions (#517)
Add vcpkg installation instructions
2020-03-25 09:08:16 +01:00
Sergiu Deitsch
dfc0e441c5
Merge pull request #523 from edbaunton/cmake-have-symbolize
Allow CMake user to disable Symbolize functionality
2020-03-25 09:05:22 +01:00
Ed Baunton
eb13e4f67c 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 <ebaunton1@bloomberg.net>
2020-02-15 17:16:14 -05:00
Michael
195d416e3b 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 <mdarr@matician.com>

* Alphabetize contributor list

* Fix inconsistent CMake style

Signed-off-by: Michael Darr <medarr@email.wm.edu>
2020-01-17 09:17:28 +01:00
Florian Mayer
74076bebc3 Explain log levels. 2020-01-10 10:50:12 +00:00
Michael Spang
130a3e10de 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
2020-01-08 15:34:39 +09:00
Shinichiro Hamaji
445af7ef7e
Merge pull request #508 from xiaosuo/close
Don't call close(2) more than once
2019-12-24 11:38:26 +09:00
Changli Gao
a35e612c55 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.
2019-12-21 23:24:28 +08:00
Marco Wang
36fa99ba2c src/logging.cc: check the entire filename format 2019-12-09 08:48:41 +08:00
Alex Stewart
0a6704b439 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.
2019-12-02 16:55:08 +00:00
Marco Wang
7764e4a8b4 src/logging.cc: match logfile with base_filename 2019-12-01 22:06:12 +08:00
Marco Wang
3b5f2807f4 src/logging.cc: encapsulate log cleaner 2019-12-01 19:12:06 +08:00
Rodrigo Queiro
1b7d541431 Add note about namespace on Win32. 2019-11-27 18:24:27 +01:00
Rodrigo Queiro
95a3655796 Remove unnecessary defines
The only macro referenced by the public headers is GOOGLE_GLOG_DLL_DECL.
This means fewer defines are propagated to rules that depend on glog.
2019-11-27 18:24:27 +01:00
Rodrigo Queiro
c0d2ceade6 Avoid leaking config.h
This uses strip_include_prefix to avoid leaking private headers
(config.h, port.h). This needs a workaround to prevent a "missing
dependency declarations" error.
2019-11-27 18:24:27 +01:00
Luc Bertrand
925858d996 add windows target to bazel CI 2019-11-20 14:21:54 +01:00
Luc Bertrand
20919b325e add windows support for bazel bazed build 2019-11-20 14:21:54 +01:00
Luc Bertrand
7f732529da apply buildifier on glog.bzl 2019-11-20 14:21:54 +01:00
Sergiu Deitsch
1863b4228c
Merge pull request #368 from UVV-gh/cmake-sdk-fix
Use libunwind as an imported target
2019-11-10 17:02:31 +01:00
Sergiu Deitsch
c0463b17b6 added cmake package config unit test 2019-11-10 15:46:47 +01:00
Sergiu Deitsch
9a43cfb8d2 install unwind find module alongside glog 2019-11-10 11:09:18 +01:00
Sergiu Deitsch
19570c69c9 renamed and cleaned up the unwind find module 2019-11-10 11:09:14 +01:00
Ezequiel Lara Gomez
58d7f873dc Added fixed log name support, take 2 (#489)
* Added fixed log name support, take 2

See https://code.google.com/p/google-glog/issues/detail?id=209 and former https://github.com/google/glog/pull/19 - this is an updated version of that patch.

It adds a flag that allows to switch behavior from base_filename + filename_extension + time_pid_string to base_filename + filename_extension, while still defaulting to the current behavior to avoid breakage in existing code. This change would allow easier log rotation schemes and better control on what's written on disk.

* Ifdef away fcntl on mingw

* Use the defined HAVE_FCNTL instead

* ifdef away tests as well

add have_sys_wait for wait() on mingw.

* OS_WINDOWS bug in fseeking to the end, only triggered here
2019-11-06 12:49:01 +01:00
Sergiu Deitsch
0bf00f95aa
Merge pull request #491 from aesophor/update-doc
doc: add information about log cleaner
2019-11-05 11:34:50 +01:00
Marco Wang
0f4975a68d doc: add information about log cleaner 2019-11-05 17:33:07 +08:00
Sergiu Deitsch
5ef521d4ad
Merge pull request #487 from Telunsu/fix_wrong_assignment
src/logging.cc: fix wrong assignment
2019-11-04 09:08:57 +01:00
yww
e58e596f13 src/logging.cc: fix wrong assignment 2019-11-04 14:35:26 +08:00
Sergiu Deitsch
f811ae9ed1
Merge pull request #485 from ffontaine/master
src/symbolize.cc: do not check for HAVE_DLFCN_H for macOS
2019-11-02 13:18:29 +01:00
Fabrice Fontaine
3ee89c86d6 src/symbolize.cc: do not check for HAVE_DLFCN_H for macOS
This seems to raise a build failure, see
10498b485f (commitcomment-35770392)

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2019-11-02 10:41:05 +01:00
Sergiu Deitsch
4d6aff4184
Merge pull request #477 from ffontaine/master
src/utilities: fix build without pthread
2019-11-02 10:24:15 +01:00
Vyacheslav Yurkov
742fe94f22 Use libunwind as an imported target
When UNWIND_LIBRARY is used directly as a public dependency then
absolute path is stored in cmake config file. This is an issue when
glog is used as part of an SDK, which was built somewhere else. When
SDK is installed on developer's machine, cmake config contains a full
path to non-existent location. The solution is to find libunwind
during configure stage and store target name as a dependency, not a full path.
Cmake module looks for libunwind and libunwind-PLAT, where PLAT is one of
supported platforms.

Signed-off-by: Vyacheslav Yurkov <uvv.mail@gmail.com>
2019-11-02 02:42:25 +01:00
Fabrice Fontaine
9630e0e848 src/utilities: fix build without pthread
- Remove is_default_thread function which is an internal and not used
  function
- Remove g_main_thread_id as it was used only by is_default_thread

Fixes:
 - http://autobuild.buildroot.net/results/5320bbe1205e782e3516d9bead8d1ed825bcbaad

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2019-11-02 02:09:07 +01:00
Sergiu Deitsch
fd3dc2c633
Merge pull request #484 from sergiud/remove-executable-flag
removed executable flag from .cmake file
2019-11-02 01:53:12 +01:00
Sergiu Deitsch
eec1435d52 removed executable flag from .cmake file 2019-11-02 00:20:22 +01:00