mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 16:35:45 +08:00
Replaced SPDLOG_FINAL macro with final
This commit is contained in:
parent
be7e7237e9
commit
65defd3806
@ -40,7 +40,7 @@ namespace details {
|
||||
class thread_pool;
|
||||
}
|
||||
|
||||
class async_logger SPDLOG_FINAL : public std::enable_shared_from_this<async_logger>, public logger
|
||||
class async_logger final : public std::enable_shared_from_this<async_logger>, public logger
|
||||
{
|
||||
friend class details::thread_pool;
|
||||
|
||||
|
@ -32,13 +32,6 @@
|
||||
#define SPDLOG_CONSTEXPR constexpr
|
||||
#endif
|
||||
|
||||
// final keyword support. On by default. See tweakme.h
|
||||
#if defined(SPDLOG_NO_FINAL)
|
||||
#define SPDLOG_FINAL
|
||||
#else
|
||||
#define SPDLOG_FINAL final
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define SPDLOG_DEPRECATED __attribute__((deprecated))
|
||||
#elif defined(_MSC_VER)
|
||||
|
@ -116,7 +116,7 @@ class B_formatter : public flag_formatter
|
||||
};
|
||||
|
||||
// Date and time representation (Thu Aug 23 15:35:46 2014)
|
||||
class c_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class c_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -142,7 +142,7 @@ class c_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// year - 2 digit
|
||||
class C_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class C_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -151,7 +151,7 @@ class C_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// Short MM/DD/YY date, equivalent to %m/%d/%y 08/23/01
|
||||
class D_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class D_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -164,7 +164,7 @@ class D_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// year - 4 digit
|
||||
class Y_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class Y_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -173,7 +173,7 @@ class Y_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// month 1-12
|
||||
class m_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class m_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -182,7 +182,7 @@ class m_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// day of month 1-31
|
||||
class d_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class d_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -191,7 +191,7 @@ class d_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// hours in 24 format 0-23
|
||||
class H_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class H_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -200,7 +200,7 @@ class H_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// hours in 12 format 1-12
|
||||
class I_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class I_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -209,7 +209,7 @@ class I_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// minutes 0-59
|
||||
class M_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class M_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -218,7 +218,7 @@ class M_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// seconds 0-59
|
||||
class S_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class S_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -227,7 +227,7 @@ class S_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// milliseconds
|
||||
class e_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class e_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -237,7 +237,7 @@ class e_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// microseconds
|
||||
class f_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class f_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -247,7 +247,7 @@ class f_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// nanoseconds
|
||||
class F_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class F_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -257,7 +257,7 @@ class F_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// seconds since epoch
|
||||
class E_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class E_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -268,7 +268,7 @@ class E_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// AM/PM
|
||||
class p_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class p_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -277,7 +277,7 @@ class p_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// 12 hour clock 02:55:02 pm
|
||||
class r_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class r_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -292,7 +292,7 @@ class r_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// 24-hour HH:MM time, equivalent to %H:%M
|
||||
class R_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class R_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -303,7 +303,7 @@ class R_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// ISO 8601 time format (HH:MM:SS), equivalent to %H:%M:%S
|
||||
class T_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class T_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &, const std::tm &tm_time, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -318,7 +318,7 @@ class T_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// ISO 8601 offset from UTC in timezone (+-HH:MM)
|
||||
class z_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class z_formatter final : public flag_formatter
|
||||
{
|
||||
public:
|
||||
const std::chrono::seconds cache_refresh = std::chrono::seconds(5);
|
||||
@ -371,7 +371,7 @@ private:
|
||||
};
|
||||
|
||||
// Thread id
|
||||
class t_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class t_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -380,7 +380,7 @@ class t_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// Current pid
|
||||
class pid_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class pid_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &, const std::tm &, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -389,7 +389,7 @@ class pid_formatter SPDLOG_FINAL : public flag_formatter
|
||||
};
|
||||
|
||||
// message counter formatter
|
||||
class i_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class i_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -397,7 +397,7 @@ class i_formatter SPDLOG_FINAL : public flag_formatter
|
||||
}
|
||||
};
|
||||
|
||||
class v_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class v_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -405,7 +405,7 @@ class v_formatter SPDLOG_FINAL : public flag_formatter
|
||||
}
|
||||
};
|
||||
|
||||
class ch_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class ch_formatter final : public flag_formatter
|
||||
{
|
||||
public:
|
||||
explicit ch_formatter(char ch)
|
||||
@ -422,7 +422,7 @@ private:
|
||||
};
|
||||
|
||||
// aggregate user chars to display as is
|
||||
class aggregate_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class aggregate_formatter final : public flag_formatter
|
||||
{
|
||||
public:
|
||||
aggregate_formatter() = default;
|
||||
@ -441,14 +441,14 @@ private:
|
||||
};
|
||||
|
||||
// mark the color range. expect it to be in the form of "%^colored text%$"
|
||||
class color_start_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class color_start_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
|
||||
{
|
||||
msg.color_range_start = dest.size();
|
||||
}
|
||||
};
|
||||
class color_stop_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class color_stop_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -458,7 +458,7 @@ class color_stop_formatter SPDLOG_FINAL : public flag_formatter
|
||||
|
||||
// Full info formatter
|
||||
// pattern: [%Y-%m-%d %H:%M:%S.%e] [%n] [%l] %v
|
||||
class full_formatter SPDLOG_FINAL : public flag_formatter
|
||||
class full_formatter final : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &msg, const std::tm &tm_time, fmt::memory_buffer &dest) override
|
||||
{
|
||||
@ -528,7 +528,7 @@ private:
|
||||
|
||||
} // namespace details
|
||||
|
||||
class pattern_formatter SPDLOG_FINAL : public formatter
|
||||
class pattern_formatter final : public formatter
|
||||
{
|
||||
public:
|
||||
explicit pattern_formatter(
|
||||
|
@ -25,7 +25,7 @@ namespace sinks {
|
||||
* If no color terminal detected, omit the escape codes.
|
||||
*/
|
||||
template<typename TargetStream, class ConsoleMutex>
|
||||
class ansicolor_sink SPDLOG_FINAL : public sink
|
||||
class ansicolor_sink final : public sink
|
||||
{
|
||||
public:
|
||||
using mutex_t = typename ConsoleMutex::mutex_t;
|
||||
@ -117,7 +117,7 @@ public:
|
||||
fflush(target_file_);
|
||||
}
|
||||
|
||||
void set_pattern(const std::string &pattern) SPDLOG_FINAL
|
||||
void set_pattern(const std::string &pattern) final
|
||||
{
|
||||
std::lock_guard<mutex_t> lock(mutex_);
|
||||
formatter_ = std::unique_ptr<spdlog::formatter>(new pattern_formatter(pattern));
|
||||
|
@ -30,25 +30,25 @@ public:
|
||||
base_sink(const base_sink &) = delete;
|
||||
base_sink &operator=(const base_sink &) = delete;
|
||||
|
||||
void log(const details::log_msg &msg) SPDLOG_FINAL
|
||||
void log(const details::log_msg &msg) final
|
||||
{
|
||||
std::lock_guard<Mutex> lock(mutex_);
|
||||
sink_it_(msg);
|
||||
}
|
||||
|
||||
void flush() SPDLOG_FINAL override
|
||||
void flush() final override
|
||||
{
|
||||
std::lock_guard<Mutex> lock(mutex_);
|
||||
flush_();
|
||||
}
|
||||
|
||||
void set_pattern(const std::string &pattern) SPDLOG_FINAL override
|
||||
void set_pattern(const std::string &pattern) final override
|
||||
{
|
||||
std::lock_guard<Mutex> lock(mutex_);
|
||||
formatter_ = std::unique_ptr<spdlog::formatter>(new pattern_formatter(pattern));
|
||||
}
|
||||
|
||||
void set_formatter(std::unique_ptr<spdlog::formatter> sink_formatter) SPDLOG_FINAL override
|
||||
void set_formatter(std::unique_ptr<spdlog::formatter> sink_formatter) final override
|
||||
{
|
||||
std::lock_guard<Mutex> lock(mutex_);
|
||||
formatter_ = std::move(sink_formatter);
|
||||
|
@ -18,7 +18,7 @@ namespace sinks {
|
||||
* Trivial file sink with single file as target
|
||||
*/
|
||||
template<typename Mutex>
|
||||
class basic_file_sink SPDLOG_FINAL : public base_sink<Mutex>
|
||||
class basic_file_sink final : public base_sink<Mutex>
|
||||
{
|
||||
public:
|
||||
explicit basic_file_sink(const filename_t &filename, bool truncate = false)
|
||||
|
@ -40,7 +40,7 @@ struct daily_filename_calculator
|
||||
* Rotating file sink based on date. rotates at midnight
|
||||
*/
|
||||
template<typename Mutex, typename FileNameCalc = daily_filename_calculator>
|
||||
class daily_file_sink SPDLOG_FINAL : public base_sink<Mutex>
|
||||
class daily_file_sink final : public base_sink<Mutex>
|
||||
{
|
||||
public:
|
||||
// create daily file sink which rotates on given time
|
||||
|
@ -24,7 +24,7 @@ namespace sinks {
|
||||
// Rotating file sink based on size
|
||||
//
|
||||
template<typename Mutex>
|
||||
class rotating_file_sink SPDLOG_FINAL : public base_sink<Mutex>
|
||||
class rotating_file_sink final : public base_sink<Mutex>
|
||||
{
|
||||
public:
|
||||
rotating_file_sink(filename_t base_filename, std::size_t max_size, std::size_t max_files)
|
||||
|
@ -108,15 +108,6 @@
|
||||
// #define SPDLOG_PREVENT_CHILD_FD
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Uncomment if your compiler doesn't support the "final" keyword.
|
||||
// The final keyword allows more optimizations in release
|
||||
// mode with recent compilers. See GCC's documentation for -Wsuggest-final-types
|
||||
// for instance.
|
||||
//
|
||||
// #define SPDLOG_NO_FINAL
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Uncomment to enable message counting feature.
|
||||
// Use the %i in the logger pattern to display log message sequence id.
|
||||
|
Loading…
Reference in New Issue
Block a user