summaryrefslogtreecommitdiff
path: root/src/Logging.cpp
Commit message (Collapse)AuthorAgeFilesLines
* refactor: Use util::TimePoint for timestampsJoel Rosdahl2022-09-211-8/+4
|
* fix: Handle failure to write to stderr when failing to write to log fileJoel Rosdahl2022-08-271-4/+8
| | | | | | | | This can happen with CCACHE_LOGFILE=/dev/stdout ccache compiler ... |& head -n 1 or similar.
* chore: Replace nonstd::string_view with std::string_viewJoel Rosdahl2022-05-231-6/+4
|
* Explicitly default use_syslog to false for clarityJoel Rosdahl2021-07-231-1/+1
|
* Move exceptions.hpp to coreJoel Rosdahl2021-07-201-1/+0
|
* Remove system.hpp, including what’s needed insteadJoel Rosdahl2021-07-071-6/+7
| | | | This is the next step after a57f70eda32e99221de56f5499079b4f00dc2bc5.
* Use static_castJoel Rosdahl2021-01-101-2/+2
|
* Always use 64bit to print time_t (#762)Khem Raj2021-01-101-1/+4
| | | | | | some 32bit architectures e.g. RISCV32 use 64bit time_t from beginning which does not fit into long int size on LP32 systems Signed-off-by: Khem Raj <raj.khem@gmail.com>
* Detect errors in fmt::print format strings at compile timeJoel Rosdahl2020-10-231-4/+5
| | | | See also 4413d842e23c6fa52ec411951a4ab442f42227de.
* Detect errors in log strings at compile timeJoel Rosdahl2020-10-231-1/+1
| | | | | | | | | | | | | | | | | | | fmtlib can detect format string errors at compile time if (1) applying FMT_STRING to the format string literal and (2) compiling for C++14 or higher. Requirement 1 is implemented by introducing a LOG macro which applies FMT_STRING to the first argument and calls Logging::log (if logging is enabled). Also added are a companion LOG_RAW macro (since C++11 requires at least one argument for the “...” part in variadic macros) and a BULK_LOG macro which calls Logging::bulk_log (if logging is enabled). Requirement 2 is implemented by setting CMAKE_CXX_STANDARD to 14 for one CI build with a known C++14-capable compiler. We can’t set it to 14 by default since we still want the code to be buildable with C++11 compilers. This will catch errors such as the one fixed by PR #691.
* Update comments, remove references to old global variables (#637)Thomas Otto2020-08-251-4/+2
|
* Rename FatalError class to FatalJoel Rosdahl2020-08-221-1/+1
| | | | | This makes the naming more consistent with the other exception classes (Error and Failure).
* Replace fatal function with throwing FatalError exception explicitlyJoel Rosdahl2020-08-031-1/+1
| | | | | I think that this improves code readability since it’s more clear what the code flow is.
* Use fmt::print instead of (f)printfJoel Rosdahl2020-08-031-4/+4
|
* Convert cc_log calls to Logging::logJoel Rosdahl2020-08-031-17/+0
|
* C++-ify logging routinesJoel Rosdahl2020-08-031-0/+208
- Simplified and C++-ified logging code. - Added Logging::log and Logging::bulk_log functions corresponding to the old cc_log and cc_bulklog functions. The new functions pass their arguments to fmt::format. - Replacements: * init_log → Logging::init * cc_log → Logging::log * cc_bulklog → Logging::bulk_log * cc_log_argv → Logging::log plus Util::format_argv_for_logging * cc_dump_debug_log_buffer -> Logging::dump_log - A legacy cc_log implementation is still available so that logging can be converted gradually to the new functionality.