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.
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
- 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.
* 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
Fixed these warnings:
src/logging_unittest.cc: At global scope:
src/logging_unittest.cc:1081:13: warning: 'void MyCheck(bool, bool)' defined but not used [-Wunused-function]
static void MyCheck(bool a, bool b) {
^~~~~~~
src/logging_unittest.cc:1078:13: warning: 'void MyFatal()' defined but not used [-Wunused-function]
static void MyFatal() {
^~~~~~~
See https://code.google.com/p/google-glog/issues/detail?id=209 - 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.
For now, we do not remove the declaration of posix_strerror_r,
but we might remove it in future.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@139 eb4d4688-79bd-11dd-afb4-1d65580434c0
src/logging_unittest.cc:591: warning: dereferencing type-punned pointer will break strict-aliasing rules
As we'll never dereference the casted pointers, it's OK to silence this warning.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@67 eb4d4688-79bd-11dd-afb4-1d65580434c0