diff --git a/include/quill/Backend.h b/include/quill/Backend.h index 30d1100c..26829e5e 100644 --- a/include/quill/Backend.h +++ b/include/quill/Backend.h @@ -1,5 +1,5 @@ /** - * @page copyright + * @page copyright * Copyright(c) 2020-present, Odysseas Georgoudis & quill contributors.* @page copyright * Distributed under the MIT License (http://opensource.org/licenses/MIT) */ @@ -220,7 +220,8 @@ class Backend if (!manual_backend_worker) { - QUILL_THROW(QuillError{"acquire_manual_backend_worker() can only be called once per process. " + QUILL_THROW( + QuillError{"acquire_manual_backend_worker() can only be called once per process. " "Additionally, it should " "not be called when start() or start_with_signal_handler() has been invoked"}); } diff --git a/include/quill/CsvWriter.h b/include/quill/CsvWriter.h index 16830206..5516272d 100644 --- a/include/quill/CsvWriter.h +++ b/include/quill/CsvWriter.h @@ -61,9 +61,9 @@ class CsvWriter cfg.set_filename_append_option(filename_append); return cfg; }()), - quill::PatternFormatterOptions{"%(message)", "", Timezone::GmtTime}); + PatternFormatterOptions{"%(message)", "", Timezone::GmtTime}); - _logger->template log_statement(quill::LogLevel::None, &header_metadata, TCsvSchema::header); + _logger->template log_statement(LogLevel::None, &header_metadata, TCsvSchema::header); } /** @@ -74,11 +74,10 @@ class CsvWriter */ CsvWriter(std::string const& unique_name, std::shared_ptr sink) { - _logger = - Frontend::create_or_get_logger(unique_name + "_csv", std::move(sink), - quill::PatternFormatterOptions{"%(message)", "", Timezone::GmtTime}); + _logger = Frontend::create_or_get_logger(unique_name + "_csv", std::move(sink), + PatternFormatterOptions{"%(message)", "", Timezone::GmtTime}); - _logger->template log_statement(quill::LogLevel::None, &header_metadata, TCsvSchema::header); + _logger->template log_statement(LogLevel::None, &header_metadata, TCsvSchema::header); } /** @@ -90,9 +89,9 @@ class CsvWriter CsvWriter(std::string const& unique_name, std::initializer_list> sinks) { _logger = Frontend::create_or_get_logger( - unique_name + "_csv", sinks, quill::PatternFormatterOptions{"%(message)", "", Timezone::GmtTime}); + unique_name + "_csv", sinks, PatternFormatterOptions{"%(message)", "", Timezone::GmtTime}); - _logger->template log_statement(quill::LogLevel::None, &header_metadata, TCsvSchema::header); + _logger->template log_statement(LogLevel::None, &header_metadata, TCsvSchema::header); } /** @@ -112,7 +111,7 @@ class CsvWriter template void append_row(Args&&... fields) { - _logger->template log_statement(quill::LogLevel::None, &line_metadata, fields...); + _logger->template log_statement(LogLevel::None, &line_metadata, fields...); } /** @@ -122,11 +121,11 @@ class CsvWriter void flush() { _logger->flush_log(); } private: - static constexpr quill::MacroMetadata header_metadata{ - "", "", "{}", nullptr, LogLevel::Info, quill::MacroMetadata::Event::Log}; + static constexpr MacroMetadata header_metadata{ + "", "", "{}", nullptr, LogLevel::Info, MacroMetadata::Event::Log}; - static constexpr quill::MacroMetadata line_metadata{ - "", "", TCsvSchema::format, nullptr, LogLevel::Info, quill::MacroMetadata::Event::Log}; + static constexpr MacroMetadata line_metadata{ + "", "", TCsvSchema::format, nullptr, LogLevel::Info, MacroMetadata::Event::Log}; LoggerImpl* _logger{nullptr}; }; diff --git a/include/quill/Logger.h b/include/quill/Logger.h index a1198f3f..649d8068 100644 --- a/include/quill/Logger.h +++ b/include/quill/Logger.h @@ -74,22 +74,22 @@ class LoggerImpl : public detail::LoggerBase #ifndef NDEBUG if (has_dynamic_log_level) { - assert((dynamic_log_level != quill::LogLevel::None) && + assert((dynamic_log_level != LogLevel::None) && "When has_dynamic_log_level is set to true then dynamic_log_level should not be None"); } - if (dynamic_log_level != quill::LogLevel::None) + if (dynamic_log_level != LogLevel::None) { - assert((macro_metadata->log_level() == quill::LogLevel::Dynamic) && + assert((macro_metadata->log_level() == LogLevel::Dynamic) && "MacroMetadata LogLevel must be Dynamic when using a dynamic_log_level"); assert(has_dynamic_log_level && "When dynamic_log_level is used then has_dynamic_log_level must also be true"); } - if (macro_metadata->log_level() != quill::LogLevel::Dynamic) + if (macro_metadata->log_level() != LogLevel::Dynamic) { - assert((dynamic_log_level == quill::LogLevel::None) && + assert((dynamic_log_level == LogLevel::None) && "No dynamic_log_level should be set when MacroMetadata LogLevel is not Dynamic"); } @@ -224,7 +224,7 @@ class LoggerImpl : public detail::LoggerBase */ void init_backtrace(uint32_t max_capacity, LogLevel flush_level = LogLevel::None) { - // we do not care about the other fields, except quill::MacroMetadata::Event::InitBacktrace + // we do not care about the other fields, except MacroMetadata::Event::InitBacktrace static constexpr MacroMetadata macro_metadata{ "", "", "{}", nullptr, LogLevel::Critical, MacroMetadata::Event::InitBacktrace}; @@ -244,7 +244,7 @@ class LoggerImpl : public detail::LoggerBase */ void flush_backtrace() { - // we do not care about the other fields, except quill::MacroMetadata::Event::Flush + // we do not care about the other fields, except MacroMetadata::Event::Flush static constexpr MacroMetadata macro_metadata{ "", "", "", nullptr, LogLevel::Critical, MacroMetadata::Event::FlushBacktrace}; diff --git a/include/quill/StringRef.h b/include/quill/StringRef.h index 647afa08..35cad248 100644 --- a/include/quill/StringRef.h +++ b/include/quill/StringRef.h @@ -46,15 +46,15 @@ class StringRef /***/ template <> -struct Codec +struct Codec { - static size_t compute_encoded_size(detail::SizeCacheVector&, quill::utility::StringRef const&) noexcept + static size_t compute_encoded_size(detail::SizeCacheVector&, utility::StringRef const&) noexcept { return sizeof(size_t) + sizeof(uintptr_t); } static void encode(std::byte*& buffer, detail::SizeCacheVector const&, uint32_t&, - quill::utility::StringRef const& no_copy) noexcept + utility::StringRef const& no_copy) noexcept { char const* data = no_copy.get_string_view().data(); std::memcpy(buffer, &data, sizeof(uintptr_t)); diff --git a/include/quill/backend/BackendManager.h b/include/quill/backend/BackendManager.h index d406a590..8a2951e2 100644 --- a/include/quill/backend/BackendManager.h +++ b/include/quill/backend/BackendManager.h @@ -44,8 +44,8 @@ class BackendManager BackendManager& operator=(BackendManager const&) = delete; private: - friend class quill::Backend; - friend class quill::BackendTscClock; + friend class Backend; + friend class BackendTscClock; /***/ BackendManager() = default; diff --git a/include/quill/backend/BackendWorker.h b/include/quill/backend/BackendWorker.h index 9a67ee1a..8a7e5314 100644 --- a/include/quill/backend/BackendWorker.h +++ b/include/quill/backend/BackendWorker.h @@ -710,7 +710,7 @@ class BackendWorker { transit_event->named_args->clear(); } - + thread_context->_transit_event_buffer->pop_front(); if (flush_flag) @@ -1498,7 +1498,7 @@ class BackendWorker } private: - friend class quill::ManualBackendWorker; + friend class ManualBackendWorker; ThreadContextManager& _thread_context_manager = ThreadContextManager::instance(); SinkManager& _sink_manager = SinkManager::instance(); diff --git a/include/quill/backend/SignalHandler.h b/include/quill/backend/SignalHandler.h index 8ddbeea9..67a8b978 100644 --- a/include/quill/backend/SignalHandler.h +++ b/include/quill/backend/SignalHandler.h @@ -150,7 +150,7 @@ void on_signal(int32_t signal_number) #endif auto logger = reinterpret_cast*>(logger_base); - QUILL_SIGNAL_HANDLER_LOG(logger, quill::LogLevel::Info, "Received signal: {} (signum: {})", + QUILL_SIGNAL_HANDLER_LOG(logger, LogLevel::Info, "Received signal: {} (signum: {})", signal_desc, signal_number); if (signal_number == SIGINT || signal_number == SIGTERM) @@ -163,7 +163,7 @@ void on_signal(int32_t signal_number) if (should_reraise_signal) { - QUILL_SIGNAL_HANDLER_LOG(logger, quill::LogLevel::Critical, + QUILL_SIGNAL_HANDLER_LOG(logger, LogLevel::Critical, "Program terminated unexpectedly due to signal: {} (signum: {})", signal_desc, signal_number); @@ -256,7 +256,7 @@ BOOL WINAPI on_console_signal(DWORD signal) if (logger_base) { auto logger = reinterpret_cast*>(logger_base); - QUILL_SIGNAL_HANDLER_LOG(logger, quill::LogLevel::Info, + QUILL_SIGNAL_HANDLER_LOG(logger, LogLevel::Info, "Program interrupted by Ctrl+C or Ctrl+Break signal"); // Pass `0` to avoid calling std::this_thread::sleep_for() @@ -285,11 +285,11 @@ LONG WINAPI on_exception(EXCEPTION_POINTERS* exception_p) { auto logger = reinterpret_cast*>(logger_base); - QUILL_SIGNAL_HANDLER_LOG(logger, quill::LogLevel::Info, "Received exception: {} (Code: {})", + QUILL_SIGNAL_HANDLER_LOG(logger, LogLevel::Info, "Received exception: {} (Code: {})", get_error_message(exception_p->ExceptionRecord->ExceptionCode), exception_p->ExceptionRecord->ExceptionCode); - QUILL_SIGNAL_HANDLER_LOG(logger, quill::LogLevel::Critical, + QUILL_SIGNAL_HANDLER_LOG(logger, LogLevel::Critical, "Program terminated unexpectedly due to exception: {} (Code: {})", get_error_message(exception_p->ExceptionRecord->ExceptionCode), exception_p->ExceptionRecord->ExceptionCode); diff --git a/include/quill/core/FrontendOptions.h b/include/quill/core/FrontendOptions.h index 81afe505..5a78eb6c 100644 --- a/include/quill/core/FrontendOptions.h +++ b/include/quill/core/FrontendOptions.h @@ -25,7 +25,7 @@ struct FrontendOptions * * By default, the library uses an UnboundedBlocking queue, which starts with initial_queue_capacity. */ - static constexpr quill::QueueType queue_type = quill::QueueType::UnboundedBlocking; + static constexpr QueueType queue_type = QueueType::UnboundedBlocking; /** * Initial capacity of the queue. Used for UnboundedBlocking, UnboundedDropping, and diff --git a/include/quill/core/UnboundedSPSCQueue.h b/include/quill/core/UnboundedSPSCQueue.h index aeed47bb..8af5dcfe 100644 --- a/include/quill/core/UnboundedSPSCQueue.h +++ b/include/quill/core/UnboundedSPSCQueue.h @@ -106,7 +106,7 @@ class UnboundedSPSCQueue * making it visible to the consumer. * @return a valid point to the buffer */ - template + template QUILL_NODISCARD QUILL_ATTRIBUTE_HOT std::byte* prepare_write(size_t nbytes) { // Try to reserve the bounded queue @@ -200,7 +200,7 @@ class UnboundedSPSCQueue private: /***/ - template + template QUILL_NODISCARD std::byte* _handle_full_queue(size_t nbytes) { // Then it means the queue doesn't have enough size diff --git a/include/quill/sinks/FileSink.h b/include/quill/sinks/FileSink.h index 80b7bf83..ef69d0ad 100644 --- a/include/quill/sinks/FileSink.h +++ b/include/quill/sinks/FileSink.h @@ -432,24 +432,24 @@ class FileSink : public StreamSink * @param time_zone Timezone to use. * @return Updated filename. */ - QUILL_NODISCARD static quill::fs::path _get_updated_filename_with_appended_datetime( - quill::fs::path const& filename, quill::FilenameAppendOption append_to_filename_option, - std::string const& append_filename_format_pattern, quill::Timezone time_zone, + QUILL_NODISCARD static fs::path _get_updated_filename_with_appended_datetime( + fs::path const& filename, FilenameAppendOption append_to_filename_option, + std::string const& append_filename_format_pattern, Timezone time_zone, std::chrono::system_clock::time_point timestamp) { - if ((append_to_filename_option == quill::FilenameAppendOption::None) || (filename == "/dev/null")) + if ((append_to_filename_option == FilenameAppendOption::None) || (filename == "/dev/null")) { return filename; } - if ((append_to_filename_option == quill::FilenameAppendOption::StartCustomTimestampFormat) || - (append_to_filename_option == quill::FilenameAppendOption::StartDate) || - (append_to_filename_option == quill::FilenameAppendOption::StartDateTime)) + if ((append_to_filename_option == FilenameAppendOption::StartCustomTimestampFormat) || + (append_to_filename_option == FilenameAppendOption::StartDate) || + (append_to_filename_option == FilenameAppendOption::StartDateTime)) { return append_datetime_to_filename(filename, append_filename_format_pattern, time_zone, timestamp); } - return quill::fs::path{}; + return fs::path{}; } private: