mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-25 01:51:38 +08:00
update clang format again
This commit is contained in:
parent
968048ced6
commit
6dffd7c6e8
@ -1,6 +1,6 @@
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: Google
|
||||
BasedOnStyle: Google
|
||||
AccessModifierOffset: -4
|
||||
Standard: c++17
|
||||
IndentWidth: 4
|
||||
|
@ -43,8 +43,7 @@ int count_lines(const char *filename) {
|
||||
auto *infile = fopen(filename, "r");
|
||||
int ch;
|
||||
while (EOF != (ch = getc(infile))) {
|
||||
if ('\n' == ch)
|
||||
counter++;
|
||||
if ('\n' == ch) counter++;
|
||||
}
|
||||
fclose(infile);
|
||||
|
||||
@ -67,7 +66,6 @@ void verify_file(const char *filename, int expected_count) {
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
int howmany = 1000000;
|
||||
int queue_size = std::min(howmany + 2, 8192);
|
||||
int threads = 10;
|
||||
@ -80,10 +78,8 @@ int main(int argc, char *argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc > 1)
|
||||
howmany = atoi(argv[1]);
|
||||
if (argc > 2)
|
||||
threads = atoi(argv[2]);
|
||||
if (argc > 1) howmany = atoi(argv[1]);
|
||||
if (argc > 2) threads = atoi(argv[2]);
|
||||
if (argc > 3) {
|
||||
queue_size = atoi(argv[3]);
|
||||
if (queue_size > 500000) {
|
||||
@ -92,8 +88,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
if (argc > 4)
|
||||
iters = atoi(argv[4]);
|
||||
if (argc > 4) iters = atoi(argv[4]);
|
||||
|
||||
auto slot_size = sizeof(spdlog::details::async_msg);
|
||||
spdlog::info("-------------------------------------------------");
|
||||
|
@ -91,7 +91,6 @@ int main(int argc, char *argv[]) {
|
||||
int iters = 250000;
|
||||
size_t threads = 4;
|
||||
try {
|
||||
|
||||
if (argc > 1) {
|
||||
iters = std::stoi(argv[1]);
|
||||
}
|
||||
|
@ -54,7 +54,6 @@ void bench_formatters() {
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
spdlog::set_pattern("[%^%l%$] %v");
|
||||
if (argc != 2) {
|
||||
spdlog::error("Usage: {} <pattern> (or \"all\" to bench all)", argv[0]);
|
||||
|
@ -311,8 +311,9 @@ void android_example() {
|
||||
#include "spdlog/pattern_formatter.h"
|
||||
class my_formatter_flag : public spdlog::custom_flag_formatter {
|
||||
public:
|
||||
void
|
||||
format(const spdlog::details::log_msg &, const std::tm &, spdlog::memory_buf_t &dest) override {
|
||||
void format(const spdlog::details::log_msg &,
|
||||
const std::tm &,
|
||||
spdlog::memory_buf_t &dest) override {
|
||||
std::string some_txt = "custom-flag";
|
||||
dest.append(some_txt.data(), some_txt.data() + some_txt.size());
|
||||
}
|
||||
|
@ -82,8 +82,9 @@ inline void init_thread_pool(size_t q_size,
|
||||
details::registry::instance().set_tp(std::move(tp));
|
||||
}
|
||||
|
||||
inline void
|
||||
init_thread_pool(size_t q_size, size_t thread_count, std::function<void()> on_thread_start) {
|
||||
inline void init_thread_pool(size_t q_size,
|
||||
size_t thread_count,
|
||||
std::function<void()> on_thread_start) {
|
||||
init_thread_pool(q_size, thread_count, on_thread_start, [] {});
|
||||
}
|
||||
|
||||
|
@ -234,8 +234,8 @@ struct source_loc {
|
||||
funcname{funcname_in} {}
|
||||
|
||||
#ifdef SPDLOG_HAVE_STD_SOURCE_LOCATION
|
||||
static constexpr source_loc
|
||||
current(const std::source_location source_location = std::source_location::current()) {
|
||||
static constexpr source_loc current(
|
||||
const std::source_location source_location = std::source_location::current()) {
|
||||
return source_loc{source_location.file_name(), source_location.line(),
|
||||
source_location.function_name()};
|
||||
}
|
||||
@ -312,21 +312,21 @@ namespace details {
|
||||
#if defined(SPDLOG_USE_STD_FORMAT)
|
||||
#if __cpp_lib_format >= 202207L // std::format and __cpp_lib_format >= 202207L
|
||||
template <typename T, typename... Args>
|
||||
[[nodiscard]] constexpr std::basic_string_view<T>
|
||||
to_string_view(std::basic_format_string<T, Args...> fmt) noexcept {
|
||||
[[nodiscard]] constexpr std::basic_string_view<T> to_string_view(
|
||||
std::basic_format_string<T, Args...> fmt) noexcept {
|
||||
return fmt.get();
|
||||
}
|
||||
#else // std::format and __cpp_lib_format < 202207L
|
||||
template <typename T, typename... Args>
|
||||
[[nodiscard]] constexpr std::basic_string_view<T>
|
||||
to_string_view(std::basic_format_string<T, Args...> fmt) noexcept {
|
||||
[[nodiscard]] constexpr std::basic_string_view<T> to_string_view(
|
||||
std::basic_format_string<T, Args...> fmt) noexcept {
|
||||
return fmt;
|
||||
}
|
||||
#endif
|
||||
#else // {fmt} version
|
||||
template <typename T, typename... Args>
|
||||
[[nodiscard]] constexpr fmt::basic_string_view<T>
|
||||
to_string_view(fmt::basic_format_string<T, Args...> fmt) noexcept {
|
||||
[[nodiscard]] constexpr fmt::basic_string_view<T> to_string_view(
|
||||
fmt::basic_format_string<T, Args...> fmt) noexcept {
|
||||
return fmt;
|
||||
}
|
||||
#endif
|
||||
|
@ -53,14 +53,10 @@ constexpr unsigned int count_digits_fallback(T n) {
|
||||
// Integer division is slow so do it for a group of four digits instead
|
||||
// of for every digit. The idea comes from the talk by Alexandrescu
|
||||
// "Three Optimization Tips for C++". See speed-test for a comparison.
|
||||
if (n < 10)
|
||||
return count;
|
||||
if (n < 100)
|
||||
return count + 1;
|
||||
if (n < 1000)
|
||||
return count + 2;
|
||||
if (n < 10000)
|
||||
return count + 3;
|
||||
if (n < 10) return count;
|
||||
if (n < 100) return count + 1;
|
||||
if (n < 1000) return count + 2;
|
||||
if (n < 10000) return count + 3;
|
||||
n /= 10000u;
|
||||
count += 4;
|
||||
}
|
||||
|
@ -71,8 +71,8 @@ inline details::dump_info<typename Container::const_iterator> to_hex(const Conta
|
||||
#if __cpp_lib_span >= 202002L
|
||||
|
||||
template <typename Value, size_t Extent>
|
||||
inline details::dump_info<typename std::span<Value, Extent>::iterator>
|
||||
to_hex(const std::span<Value, Extent> &container, size_t size_per_line = 32) {
|
||||
inline details::dump_info<typename std::span<Value, Extent>::iterator> to_hex(
|
||||
const std::span<Value, Extent> &container, size_t size_per_line = 32) {
|
||||
using Container = std::span<Value, Extent>;
|
||||
static_assert(sizeof(typename Container::value_type) == 1,
|
||||
"sizeof(Container::value_type) != 1");
|
||||
@ -84,8 +84,9 @@ to_hex(const std::span<Value, Extent> &container, size_t size_per_line = 32) {
|
||||
|
||||
// create dump_info from ranges
|
||||
template <typename It>
|
||||
inline details::dump_info<It>
|
||||
to_hex(const It range_begin, const It range_end, size_t size_per_line = 32) {
|
||||
inline details::dump_info<It> to_hex(const It range_begin,
|
||||
const It range_end,
|
||||
size_t size_per_line = 32) {
|
||||
return details::dump_info<It>(range_begin, range_end, size_per_line);
|
||||
}
|
||||
|
||||
|
@ -43,8 +43,9 @@ public:
|
||||
: padinfo_(padinfo) {}
|
||||
flag_formatter() = default;
|
||||
virtual ~flag_formatter() = default;
|
||||
virtual void
|
||||
format(const details::log_msg &msg, const std::tm &tm_time, memory_buf_t &dest) = 0;
|
||||
virtual void format(const details::log_msg &msg,
|
||||
const std::tm &tm_time,
|
||||
memory_buf_t &dest) = 0;
|
||||
|
||||
protected:
|
||||
padding_info padinfo_;
|
||||
|
@ -74,14 +74,14 @@ private:
|
||||
// __android_log_buf_write, if user explicitly provides a non-default log buffer. Otherwise,
|
||||
// when using the default log buffer, always log via __android_log_write.
|
||||
template <int ID = BufferID>
|
||||
typename std::enable_if<ID == static_cast<int>(log_id::LOG_ID_MAIN), int>::type
|
||||
android_log(int prio, const char *tag, const char *text) {
|
||||
typename std::enable_if<ID == static_cast<int>(log_id::LOG_ID_MAIN), int>::type android_log(
|
||||
int prio, const char *tag, const char *text) {
|
||||
return __android_log_write(prio, tag, text);
|
||||
}
|
||||
|
||||
template <int ID = BufferID>
|
||||
typename std::enable_if<ID != static_cast<int>(log_id::LOG_ID_MAIN), int>::type
|
||||
android_log(int prio, const char *tag, const char *text) {
|
||||
typename std::enable_if<ID != static_cast<int>(log_id::LOG_ID_MAIN), int>::type android_log(
|
||||
int prio, const char *tag, const char *text) {
|
||||
return __android_log_buf_write(ID, prio, tag, text);
|
||||
}
|
||||
|
||||
|
@ -212,8 +212,8 @@ inline std::shared_ptr<logger> daily_logger_mt(const std::string &logger_name,
|
||||
}
|
||||
|
||||
template <typename Factory = spdlog::synchronous_factory>
|
||||
inline std::shared_ptr<logger>
|
||||
daily_logger_format_mt(const std::string &logger_name,
|
||||
inline std::shared_ptr<logger> daily_logger_format_mt(
|
||||
const std::string &logger_name,
|
||||
const filename_t &filename,
|
||||
int hour = 0,
|
||||
int minute = 0,
|
||||
@ -237,8 +237,8 @@ inline std::shared_ptr<logger> daily_logger_st(const std::string &logger_name,
|
||||
}
|
||||
|
||||
template <typename Factory = spdlog::synchronous_factory>
|
||||
inline std::shared_ptr<logger>
|
||||
daily_logger_format_st(const std::string &logger_name,
|
||||
inline std::shared_ptr<logger> daily_logger_format_st(
|
||||
const std::string &logger_name,
|
||||
const filename_t &filename,
|
||||
int hour = 0,
|
||||
int minute = 0,
|
||||
|
@ -105,14 +105,14 @@ inline std::shared_ptr<logger> kafka_logger_st(const std::string &logger_name,
|
||||
}
|
||||
|
||||
template <typename Factory = spdlog::async_factory>
|
||||
inline std::shared_ptr<spdlog::logger>
|
||||
kafka_logger_async_mt(std::string logger_name, spdlog::sinks::kafka_sink_config config) {
|
||||
inline std::shared_ptr<spdlog::logger> kafka_logger_async_mt(
|
||||
std::string logger_name, spdlog::sinks::kafka_sink_config config) {
|
||||
return Factory::template create<sinks::kafka_sink_mt>(logger_name, config);
|
||||
}
|
||||
|
||||
template <typename Factory = spdlog::async_factory>
|
||||
inline std::shared_ptr<spdlog::logger>
|
||||
kafka_logger_async_st(std::string logger_name, spdlog::sinks::kafka_sink_config config) {
|
||||
inline std::shared_ptr<spdlog::logger> kafka_logger_async_st(
|
||||
std::string logger_name, spdlog::sinks::kafka_sink_config config) {
|
||||
return Factory::template create<sinks::kafka_sink_st>(logger_name, config);
|
||||
}
|
||||
|
||||
|
@ -86,8 +86,8 @@ using mongo_sink_st = mongo_sink<spdlog::details::null_mutex>;
|
||||
} // namespace sinks
|
||||
|
||||
template <typename Factory = spdlog::synchronous_factory>
|
||||
inline std::shared_ptr<logger>
|
||||
mongo_logger_mt(const std::string &logger_name,
|
||||
inline std::shared_ptr<logger> mongo_logger_mt(
|
||||
const std::string &logger_name,
|
||||
const std::string &db_name,
|
||||
const std::string &collection_name,
|
||||
const std::string &uri = "mongodb://localhost:27017") {
|
||||
@ -96,8 +96,8 @@ mongo_logger_mt(const std::string &logger_name,
|
||||
}
|
||||
|
||||
template <typename Factory = spdlog::synchronous_factory>
|
||||
inline std::shared_ptr<logger>
|
||||
mongo_logger_st(const std::string &logger_name,
|
||||
inline std::shared_ptr<logger> mongo_logger_st(
|
||||
const std::string &logger_name,
|
||||
const std::string &db_name,
|
||||
const std::string &collection_name,
|
||||
const std::string &uri = "mongodb://localhost:27017") {
|
||||
|
@ -269,14 +269,16 @@ inline std::shared_ptr<logger> qt_logger_st(const std::string &logger_name,
|
||||
}
|
||||
// log to QObject
|
||||
template <typename Factory = spdlog::synchronous_factory>
|
||||
inline std::shared_ptr<logger>
|
||||
qt_logger_mt(const std::string &logger_name, QObject *qt_object, const std::string &meta_method) {
|
||||
inline std::shared_ptr<logger> qt_logger_mt(const std::string &logger_name,
|
||||
QObject *qt_object,
|
||||
const std::string &meta_method) {
|
||||
return Factory::template create<sinks::qt_sink_mt>(logger_name, qt_object, meta_method);
|
||||
}
|
||||
|
||||
template <typename Factory = spdlog::synchronous_factory>
|
||||
inline std::shared_ptr<logger>
|
||||
qt_logger_st(const std::string &logger_name, QObject *qt_object, const std::string &meta_method) {
|
||||
inline std::shared_ptr<logger> qt_logger_st(const std::string &logger_name,
|
||||
QObject *qt_object,
|
||||
const std::string &meta_method) {
|
||||
return Factory::template create<sinks::qt_sink_st>(logger_name, qt_object, meta_method);
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@ namespace sinks {
|
||||
*/
|
||||
template <typename Mutex>
|
||||
class syslog_sink : public base_sink<Mutex> {
|
||||
|
||||
public:
|
||||
syslog_sink(std::string ident, int syslog_option, int syslog_facility, bool enable_formatting)
|
||||
: enable_formatting_{enable_formatting},
|
||||
|
@ -238,8 +238,7 @@ public:
|
||||
}
|
||||
|
||||
~win_eventlog_sink() {
|
||||
if (hEventLog_)
|
||||
DeregisterEventSource(hEventLog_);
|
||||
if (hEventLog_) DeregisterEventSource(hEventLog_);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -68,7 +68,6 @@ namespace details {
|
||||
namespace os {
|
||||
|
||||
spdlog::log_clock::time_point now() noexcept {
|
||||
|
||||
#if defined __linux__ && defined SPDLOG_CLOCK_COARSE
|
||||
timespec ts;
|
||||
::clock_gettime(CLOCK_REALTIME_COARSE, &ts);
|
||||
@ -81,7 +80,6 @@ spdlog::log_clock::time_point now() noexcept {
|
||||
#endif
|
||||
}
|
||||
std::tm localtime(const std::time_t &time_tt) noexcept {
|
||||
|
||||
#ifdef _WIN32
|
||||
std::tm tm;
|
||||
::localtime_s(&tm, &time_tt);
|
||||
@ -98,7 +96,6 @@ std::tm localtime() noexcept {
|
||||
}
|
||||
|
||||
std::tm gmtime(const std::time_t &time_tt) noexcept {
|
||||
|
||||
#ifdef _WIN32
|
||||
std::tm tm;
|
||||
::gmtime_s(&tm, &time_tt);
|
||||
@ -243,7 +240,6 @@ size_t filesize(FILE *f) {
|
||||
|
||||
// Return utc offset in minutes or throw spdlog_ex on failure
|
||||
int utc_minutes_offset(const std::tm &tm) {
|
||||
|
||||
#ifdef _WIN32
|
||||
#if _WIN32_WINNT < _WIN32_WINNT_WS08
|
||||
TIME_ZONE_INFORMATION tzinfo;
|
||||
@ -252,8 +248,7 @@ int utc_minutes_offset(const std::tm &tm) {
|
||||
DYNAMIC_TIME_ZONE_INFORMATION tzinfo;
|
||||
auto rv = ::GetDynamicTimeZoneInformation(&tzinfo);
|
||||
#endif
|
||||
if (rv == TIME_ZONE_ID_INVALID)
|
||||
throw_spdlog_ex("Failed getting timezone info. ", errno);
|
||||
if (rv == TIME_ZONE_ID_INVALID) throw_spdlog_ex("Failed getting timezone info. ", errno);
|
||||
|
||||
int offset = -tzinfo.Bias;
|
||||
if (tm.tm_isdst) {
|
||||
@ -379,7 +374,6 @@ std::string filename_to_str(const filename_t &filename) { return filename; }
|
||||
#endif
|
||||
|
||||
int pid() noexcept {
|
||||
|
||||
#ifdef _WIN32
|
||||
return static_cast<int>(::GetCurrentProcessId());
|
||||
#else
|
||||
@ -421,7 +415,6 @@ bool is_color_terminal() noexcept {
|
||||
// Determine if the terminal attached
|
||||
// Source: https://github.com/agauniyal/rang/
|
||||
bool in_terminal(FILE *file) noexcept {
|
||||
|
||||
#ifdef _WIN32
|
||||
return ::_isatty(_fileno(file)) != 0;
|
||||
#else
|
||||
@ -546,7 +539,6 @@ filename_t dir_name(const filename_t &path) {
|
||||
}
|
||||
|
||||
std::string getenv(const char *field) {
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(__cplusplus_winrt)
|
||||
return std::string{}; // not supported under uwp
|
||||
|
@ -28,7 +28,6 @@ namespace details {
|
||||
|
||||
registry::registry()
|
||||
: formatter_(new pattern_formatter()) {
|
||||
|
||||
#ifndef SPDLOG_DISABLE_DEFAULT_LOGGER
|
||||
// create default logger (ansicolor_stdout_sink_mt or wincolor_stdout_sink_mt in windows).
|
||||
#ifdef _WIN32
|
||||
|
@ -14,7 +14,8 @@ thread_pool::thread_pool(size_t q_max_items,
|
||||
std::function<void()> on_thread_stop)
|
||||
: q_(q_max_items) {
|
||||
if (threads_n == 0 || threads_n > 1000) {
|
||||
throw_spdlog_ex("spdlog::thread_pool(): invalid threads_n param (valid "
|
||||
throw_spdlog_ex(
|
||||
"spdlog::thread_pool(): invalid threads_n param (valid "
|
||||
"range is 1-1000)");
|
||||
}
|
||||
for (size_t i = 0; i < threads_n; i++) {
|
||||
|
@ -23,8 +23,10 @@ template FMT_API auto decimal_point_impl(locale_ref) -> char;
|
||||
|
||||
template FMT_API void buffer<char>::append(const char *, const char *);
|
||||
|
||||
template FMT_API void
|
||||
vformat_to(buffer<char> &, string_view, typename vformat_args<>::type, locale_ref);
|
||||
template FMT_API void vformat_to(buffer<char> &,
|
||||
string_view,
|
||||
typename vformat_args<>::type,
|
||||
locale_ref);
|
||||
|
||||
// Explicit instantiations for wchar_t.
|
||||
|
||||
|
@ -958,7 +958,8 @@ void pattern_formatter::handle_flag_(char flag, details::padding_info padding) {
|
||||
break;
|
||||
|
||||
case 'L': // short level
|
||||
formatters_.push_back(std::make_unique<details::short_level_formatter<Padder>>(padding));
|
||||
formatters_.push_back(
|
||||
std::make_unique<details::short_level_formatter<Padder>>(padding));
|
||||
break;
|
||||
|
||||
case ('t'): // thread id
|
||||
@ -1101,7 +1102,8 @@ void pattern_formatter::handle_flag_(char flag, details::padding_info padding) {
|
||||
break;
|
||||
|
||||
case ('s'): // short source filename - without directory name
|
||||
formatters_.push_back(std::make_unique<details::short_filename_formatter<Padder>>(padding));
|
||||
formatters_.push_back(
|
||||
std::make_unique<details::short_filename_formatter<Padder>>(padding));
|
||||
break;
|
||||
|
||||
case ('g'): // full source filename
|
||||
@ -1110,7 +1112,8 @@ void pattern_formatter::handle_flag_(char flag, details::padding_info padding) {
|
||||
break;
|
||||
|
||||
case ('#'): // source line number
|
||||
formatters_.push_back(std::make_unique<details::source_linenum_formatter<Padder>>(padding));
|
||||
formatters_.push_back(
|
||||
std::make_unique<details::source_linenum_formatter<Padder>>(padding));
|
||||
break;
|
||||
|
||||
case ('!'): // source funcname
|
||||
@ -1142,7 +1145,8 @@ void pattern_formatter::handle_flag_(char flag, details::padding_info padding) {
|
||||
|
||||
case ('O'): // elapsed time since last log message in seconds
|
||||
formatters_.push_back(
|
||||
std::make_unique<details::elapsed_formatter<Padder, std::chrono::seconds>>(padding));
|
||||
std::make_unique<details::elapsed_formatter<Padder, std::chrono::seconds>>(
|
||||
padding));
|
||||
break;
|
||||
|
||||
default: // Unknown flag appears as is
|
||||
@ -1153,9 +1157,9 @@ void pattern_formatter::handle_flag_(char flag, details::padding_info padding) {
|
||||
unknown_flag->add_ch(flag);
|
||||
formatters_.push_back((std::move(unknown_flag)));
|
||||
}
|
||||
// fix issue #1617 (prev char was '!' and should have been treated as funcname flag instead
|
||||
// of truncating flag) spdlog::set_pattern("[%10!] %v") => "[ main] some message"
|
||||
// spdlog::set_pattern("[%3!!] %v") => "[mai] some message"
|
||||
// fix issue #1617 (prev char was '!' and should have been treated as funcname flag
|
||||
// instead of truncating flag) spdlog::set_pattern("[%10!] %v") => "[ main] some
|
||||
// message" spdlog::set_pattern("[%3!!] %v") => "[mai] some message"
|
||||
else {
|
||||
padding.truncate_ = false;
|
||||
formatters_.push_back(
|
||||
|
@ -106,11 +106,12 @@ void rotating_file_sink<Mutex>::rotate_() {
|
||||
if (!rename_file_(src, target)) {
|
||||
// if failed try again after a small delay.
|
||||
// this is a workaround to a windows issue, where very high rotation
|
||||
// rates can cause the rename to fail with permission denied (because of antivirus?).
|
||||
// rates can cause the rename to fail with permission denied (because of
|
||||
// antivirus?).
|
||||
details::os::sleep_for_millis(100);
|
||||
if (!rename_file_(src, target)) {
|
||||
file_helper_.reopen(
|
||||
true); // truncate the log file anyway to prevent it to grow beyond its limit!
|
||||
file_helper_.reopen(true); // truncate the log file anyway to prevent it
|
||||
// to grow beyond its limit!
|
||||
current_size_ = 0;
|
||||
throw_spdlog_ex("rotating_file_sink: failed renaming " + filename_to_str(src) +
|
||||
" to " + filename_to_str(target),
|
||||
|
@ -47,14 +47,14 @@ template SPDLOG_API std::shared_ptr<spdlog::logger>
|
||||
spdlog::stderr_color_st<spdlog::synchronous_factory>(const std::string &logger_name,
|
||||
color_mode mode);
|
||||
|
||||
template SPDLOG_API std::shared_ptr<spdlog::logger>
|
||||
spdlog::stdout_color_mt<spdlog::async_factory>(const std::string &logger_name, color_mode mode);
|
||||
template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stdout_color_mt<spdlog::async_factory>(
|
||||
const std::string &logger_name, color_mode mode);
|
||||
|
||||
template SPDLOG_API std::shared_ptr<spdlog::logger>
|
||||
spdlog::stdout_color_st<spdlog::async_factory>(const std::string &logger_name, color_mode mode);
|
||||
template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stdout_color_st<spdlog::async_factory>(
|
||||
const std::string &logger_name, color_mode mode);
|
||||
|
||||
template SPDLOG_API std::shared_ptr<spdlog::logger>
|
||||
spdlog::stderr_color_mt<spdlog::async_factory>(const std::string &logger_name, color_mode mode);
|
||||
template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stderr_color_mt<spdlog::async_factory>(
|
||||
const std::string &logger_name, color_mode mode);
|
||||
|
||||
template SPDLOG_API std::shared_ptr<spdlog::logger>
|
||||
spdlog::stderr_color_st<spdlog::async_factory>(const std::string &logger_name, color_mode mode);
|
||||
template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stderr_color_st<spdlog::async_factory>(
|
||||
const std::string &logger_name, color_mode mode);
|
||||
|
@ -141,11 +141,11 @@ spdlog::stderr_logger_mt<spdlog::synchronous_factory>(const std::string &logger_
|
||||
template SPDLOG_API std::shared_ptr<spdlog::logger>
|
||||
spdlog::stderr_logger_st<spdlog::synchronous_factory>(const std::string &logger_name);
|
||||
|
||||
template SPDLOG_API std::shared_ptr<spdlog::logger>
|
||||
spdlog::stdout_logger_mt<spdlog::async_factory>(const std::string &logger_name);
|
||||
template SPDLOG_API std::shared_ptr<spdlog::logger>
|
||||
spdlog::stdout_logger_st<spdlog::async_factory>(const std::string &logger_name);
|
||||
template SPDLOG_API std::shared_ptr<spdlog::logger>
|
||||
spdlog::stderr_logger_mt<spdlog::async_factory>(const std::string &logger_name);
|
||||
template SPDLOG_API std::shared_ptr<spdlog::logger>
|
||||
spdlog::stderr_logger_st<spdlog::async_factory>(const std::string &logger_name);
|
||||
template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stdout_logger_mt<spdlog::async_factory>(
|
||||
const std::string &logger_name);
|
||||
template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stdout_logger_st<spdlog::async_factory>(
|
||||
const std::string &logger_name);
|
||||
template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stderr_logger_mt<spdlog::async_factory>(
|
||||
const std::string &logger_name);
|
||||
template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stderr_logger_st<spdlog::async_factory>(
|
||||
const std::string &logger_name);
|
||||
|
@ -94,7 +94,6 @@ TEST_CASE("flush", "[async]") {
|
||||
}
|
||||
|
||||
TEST_CASE("async periodic flush", "[async]") {
|
||||
|
||||
auto logger = spdlog::create_async<spdlog::sinks::test_sink_mt>("as");
|
||||
auto test_sink = std::static_pointer_cast<spdlog::sinks::test_sink_mt>(logger->sinks()[0]);
|
||||
|
||||
|
@ -37,7 +37,6 @@ TEST_CASE("daily_logger with dateonly calculator", "[daily_logger]") {
|
||||
|
||||
auto logger = spdlog::create<sink_type>("logger", basename, 0, 0);
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
|
||||
logger->info("Test message {}", i);
|
||||
}
|
||||
logger->flush();
|
||||
|
@ -100,8 +100,7 @@ TEST_CASE("async_error_handler2", "[errors]") {
|
||||
auto logger = spdlog::create_async<failing_sink>("failed_logger");
|
||||
logger->set_error_handler([=](const std::string &) {
|
||||
std::ofstream ofs("test_logs/custom_err2.txt");
|
||||
if (!ofs)
|
||||
throw std::runtime_error("Failed open test_logs/custom_err2.txt");
|
||||
if (!ofs) throw std::runtime_error("Failed open test_logs/custom_err2.txt");
|
||||
ofs << err_msg;
|
||||
});
|
||||
logger->info("Hello failure");
|
||||
|
@ -85,7 +85,6 @@ TEST_CASE("rotating_file_logger2", "[rotating_logger]") {
|
||||
require_message_count(ROTATING_LOG, 10);
|
||||
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
|
||||
logger->info("Test message {}", i);
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
#define TEST_FILENAME "test_logs/simple_log"
|
||||
|
||||
TEST_CASE("debug and trace w/o format string", "[macros]") {
|
||||
|
||||
prepare_logdir();
|
||||
spdlog::filename_t filename = SPDLOG_FILENAME_T(TEST_FILENAME);
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
template <class T>
|
||||
std::string log_info(const T &what, spdlog::level logger_level = spdlog::level::info) {
|
||||
|
||||
std::ostringstream oss;
|
||||
auto oss_sink = std::make_shared<spdlog::sinks::ostream_sink_mt>(oss);
|
||||
|
||||
|
@ -22,7 +22,6 @@ TEST_CASE("dequeue-empty-nowait", "[mpmc_blocking_q]") {
|
||||
}
|
||||
|
||||
TEST_CASE("dequeue-empty-wait", "[mpmc_blocking_q]") {
|
||||
|
||||
size_t q_size = 100;
|
||||
milliseconds wait_ms(250);
|
||||
milliseconds tolerance_wait(250);
|
||||
@ -59,7 +58,6 @@ TEST_CASE("dequeue-full-wait", "[mpmc_blocking_q]") {
|
||||
}
|
||||
|
||||
TEST_CASE("enqueue_nowait", "[mpmc_blocking_q]") {
|
||||
|
||||
size_t q_size = 1;
|
||||
spdlog::details::mpmc_blocking_queue<int> q(q_size);
|
||||
milliseconds tolerance_wait(10);
|
||||
|
@ -35,8 +35,7 @@ std::size_t count_lines(const std::string &filename) {
|
||||
|
||||
std::string line;
|
||||
size_t counter = 0;
|
||||
while (std::getline(ifs, line))
|
||||
counter++;
|
||||
while (std::getline(ifs, line)) counter++;
|
||||
return counter;
|
||||
}
|
||||
|
||||
@ -76,8 +75,7 @@ std::size_t count_files(const std::string &folder) {
|
||||
if (hFind != INVALID_HANDLE_VALUE) {
|
||||
do // Managed to locate and create an handle to that folder.
|
||||
{
|
||||
if (ffd.cFileName[0] != '.')
|
||||
counter++;
|
||||
if (ffd.cFileName[0] != '.') counter++;
|
||||
} while (::FindNextFileA(hFind, &ffd) != 0);
|
||||
::FindClose(hFind);
|
||||
} else {
|
||||
@ -97,8 +95,7 @@ std::size_t count_files(const std::string &folder) {
|
||||
|
||||
struct dirent *ep = nullptr;
|
||||
while ((ep = readdir(dp)) != nullptr) {
|
||||
if (ep->d_name[0] != '.')
|
||||
counter++;
|
||||
if (ep->d_name[0] != '.') counter++;
|
||||
}
|
||||
(void)closedir(dp);
|
||||
return counter;
|
||||
|
Loading…
Reference in New Issue
Block a user