diff --git a/main/logging.cpp b/main/logging.cpp index d6fb920..2bdb40d 100644 --- a/main/logging.cpp +++ b/main/logging.cpp @@ -20,7 +20,7 @@ class LogSinkBackend { void flush(); public: - LogSinkBackend() {} + LogSinkBackend() = default; std::ostream &getOutput() { return buffer; } @@ -51,8 +51,11 @@ std::ofstream openLogFile() { } } // namespace +// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables): TODO std::mutex logFileMutex; +// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) std::ofstream logFile = openLogFile(); +// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) thread_local detail::LogSinkBackend theBackend; std::ostream &detail::LogSink::getStream() const { @@ -77,7 +80,7 @@ detail::LogSink::~LogSink() { } } -detail::LogSink::LogSink(LogSink &&moveFrom) +detail::LogSink::LogSink(LogSink &&moveFrom) noexcept : isCurrentSink(moveFrom.isCurrentSink) { moveFrom.isCurrentSink = false; } @@ -98,6 +101,7 @@ void detail::LogSinkBackend::flush() { namespace { // FIXME This approach is horribly inefficient. It is also unsafe if any // other piece of code wants access to std::localtime. +// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) std::mutex getLocalTimeMutex; std::tm getLocalTimeAndDontExplodePlease() { std::lock_guard lock(getLocalTimeMutex); diff --git a/main/logging.h b/main/logging.h index 6481dd8..de8322f 100644 --- a/main/logging.h +++ b/main/logging.h @@ -23,7 +23,7 @@ class LogSink : private progressia::main::NonCopyable { LogSink(bool isCurrentSink); ~LogSink(); - LogSink(LogSink &&); + LogSink(LogSink &&) noexcept; template friend const LogSink &operator<<(const LogSink &sink, const T &x) {