Since #846, `HAVE_UNWIND_H` is not really in use. Instead we should use `HAVE__UNWIND_BACKTRACE` and `HAVE__UNWIND_GETIP` (added in #846). To prevent that from happening again, also added Bazel tests that confirm stacktrace are still working.
1. Initializing std::ostringstream with a string makes no sense, as the
string becomes an initial value of an underlying buffer; seek-to-end
is not performed, so the initial value gets completely overwritten by
subsequent writing.
2. Flag `log_year_in_prefix` should be considered, as if formatting a
regular logging message.
3. Writing a buffer to std::ostream is better expressed with write(s,n).
As specified in the doc comment for SetLogger, "the logger becomes the
property of the logging module and should not be deleted by the caller".
Not only should the LogDestination delete a custom logger in its
destructor, but it should also delete a previous logger when another
logger is passed to SetLogger().
Co-authored-by: Sergiu Deitsch <sergiud@users.noreply.github.com>
Log lines can be customized for parsing by an external tool.
To simplify such customization and parsing, there should be an option to
customize the file header, or at least to disable adding it.
Calling FormatMessage without a FORMAT_MESSAGE_IGNORE_INSERTS flag could
cause trouble, as explained in an article by Raymond Chen:
* The importance of the FORMAT_MESSAGE_IGNORE_INSERTS flag
https://devblogs.microsoft.com/oldnewthing/20071128-00/?p=24353
The previous approach used
--incompatible_enable_cc_toolchain_resolution, which is recommended by
the docs, but a Bazel developer told me it's obsolete. The new, old
approach is simpler and should stop the warning from being user-visible.
Use GetExistingTempDirectories() (which uses GetTempDirectories() which respects
TEST_TMPDIR, TMPDIR, TMP environmental variables) for FLAGS_test_tmpdir variable
used in some tests.
Fixes: #793
Currently, glog allows to use of logtostderr to send error logs to
stderr, but many log tailers would regard logs from stderr as error
logs. So we want to send non-error logs to stdout and only send error
logs to stderr according to the stderrthreshold.
Correct syntax to run CMake built-in command-line tools is `cmake -E`:
https://cmake.org/cmake/help/v3.23/manual/cmake.1.html#run-a-command-line-tool
This test was mistakenly using `cmake env ... cmake ...`, where `env` and second `cmake`
were interpreted as paths (of source directory or build directory), resulting
in "Ignoring extra path from command line" CMake warnings with CMake 3.23:
eacf1f879b