mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-29 01:29:35 +08:00
Clang format
This commit is contained in:
@@ -63,4 +63,3 @@ private:
|
||||
async_overflow_policy overflow_policy_;
|
||||
};
|
||||
} // namespace spdlog
|
||||
|
||||
|
@@ -37,7 +37,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(SPDLOG_SHARED_LIB)
|
||||
# if defined(_WIN32)
|
||||
# ifdef spdlog_EXPORTS
|
||||
@@ -134,7 +133,6 @@ using wmemory_buf_t = fmt::basic_memory_buffer<wchar_t, 250>;
|
||||
# define SPDLOG_BUF_TO_STRING(x) fmt::to_string(x)
|
||||
#endif // SPDLOG_USE_STD_FORMAT
|
||||
|
||||
|
||||
#define SPDLOG_LEVEL_TRACE 0
|
||||
#define SPDLOG_LEVEL_DEBUG 1
|
||||
#define SPDLOG_LEVEL_INFO 2
|
||||
@@ -165,17 +163,23 @@ enum class level
|
||||
};
|
||||
|
||||
#if defined(SPDLOG_NO_ATOMIC_LEVELS)
|
||||
using atomic_level_t = details::null_atomic<level>;
|
||||
using atomic_level_t = details::null_atomic<level>;
|
||||
#else
|
||||
using atomic_level_t = std::atomic<level>;
|
||||
using atomic_level_t = std::atomic<level>;
|
||||
#endif
|
||||
|
||||
#if !defined(SPDLOG_LEVEL_NAMES)
|
||||
#define SPDLOG_LEVEL_NAMES { "trace", "debug", "info", "warning", "error", "critical", "off"}
|
||||
# define SPDLOG_LEVEL_NAMES \
|
||||
{ \
|
||||
"trace", "debug", "info", "warning", "error", "critical", "off" \
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(SPDLOG_SHORT_LEVEL_NAMES)
|
||||
#define SPDLOG_SHORT_LEVEL_NAMES {"T", "D", "I", "W", "E", "C", "O"}
|
||||
# define SPDLOG_SHORT_LEVEL_NAMES \
|
||||
{ \
|
||||
"T", "D", "I", "W", "E", "C", "O" \
|
||||
}
|
||||
#endif
|
||||
|
||||
[[nodiscard]] constexpr size_t level_to_number(level lvl) noexcept
|
||||
@@ -198,8 +202,6 @@ constexpr std::array<const char *, levels_count> short_level_names SPDLOG_SHORT_
|
||||
|
||||
SPDLOG_API [[nodiscard]] spdlog::level level_from_str(const std::string &name) noexcept;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Color mode used by sinks with color support.
|
||||
//
|
||||
|
@@ -31,4 +31,3 @@ struct SPDLOG_API log_msg
|
||||
};
|
||||
} // namespace details
|
||||
} // namespace spdlog
|
||||
|
||||
|
@@ -27,4 +27,3 @@ public:
|
||||
|
||||
} // namespace details
|
||||
} // namespace spdlog
|
||||
|
||||
|
@@ -116,4 +116,3 @@ SPDLOG_API bool fsync(FILE *fp);
|
||||
} // namespace os
|
||||
} // namespace details
|
||||
} // namespace spdlog
|
||||
|
||||
|
@@ -27,7 +27,7 @@
|
||||
{ \
|
||||
if (!location.empty()) \
|
||||
{ \
|
||||
err_handler_(fmt_lib::format("{} [{}({})]", ex.what(), location.filename, location.line)); \
|
||||
err_handler_(fmt_lib::format("{} [{}({})]", ex.what(), location.filename, location.line)); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
|
@@ -122,4 +122,3 @@ private:
|
||||
void compile_pattern_(const std::string &pattern);
|
||||
};
|
||||
} // namespace spdlog
|
||||
|
||||
|
@@ -46,4 +46,3 @@ protected:
|
||||
};
|
||||
} // namespace sinks
|
||||
} // namespace spdlog
|
||||
|
||||
|
@@ -54,4 +54,3 @@ inline std::shared_ptr<logger> basic_logger_st(
|
||||
}
|
||||
|
||||
} // namespace spdlog
|
||||
|
||||
|
@@ -33,8 +33,8 @@ struct daily_filename_calculator
|
||||
{
|
||||
filename_t basename, ext;
|
||||
std::tie(basename, ext) = details::file_helper::split_by_extension(filename);
|
||||
return fmt_lib::format(SPDLOG_FILENAME_T("{}_{:04d}-{:02d}-{:02d}{}"), basename, now_tm.tm_year + 1900,
|
||||
now_tm.tm_mon + 1, now_tm.tm_mday, ext);
|
||||
return fmt_lib::format(
|
||||
SPDLOG_FILENAME_T("{}_{:04d}-{:02d}-{:02d}{}"), basename, now_tm.tm_year + 1900, now_tm.tm_mon + 1, now_tm.tm_mday, ext);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -66,9 +66,10 @@ protected:
|
||||
|
||||
if (client_ != nullptr)
|
||||
{
|
||||
auto doc = document{} << "timestamp" << bsoncxx::types::b_date(msg.time) << "level" << level::to_string_view(msg.log_level).data()
|
||||
<< "level_num" << msg.log_level << "message" << std::string(msg.payload.begin(), msg.payload.end())
|
||||
<< "logger_name" << std::string(msg.logger_name.begin(), msg.logger_name.end()) << "thread_id"
|
||||
auto doc = document{} << "timestamp" << bsoncxx::types::b_date(msg.time) << "level"
|
||||
<< level::to_string_view(msg.log_level).data() << "level_num" << msg.log_level << "message"
|
||||
<< std::string(msg.payload.begin(), msg.payload.end()) << "logger_name"
|
||||
<< std::string(msg.logger_name.begin(), msg.logger_name.end()) << "thread_id"
|
||||
<< static_cast<int>(msg.thread_id) << finalize;
|
||||
client_->database(db_name_).collection(coll_name_).insert_one(doc.view());
|
||||
}
|
||||
|
@@ -185,7 +185,7 @@ protected:
|
||||
qt_text_edit_, // text edit to append to
|
||||
std::move(payload), // text to append
|
||||
default_color_, // default color
|
||||
colors_.at(msg.log_level), // color to apply
|
||||
colors_.at(msg.log_level), // color to apply
|
||||
color_range_start, // color range start
|
||||
color_range_end}; // color range end
|
||||
|
||||
|
@@ -29,4 +29,3 @@ protected:
|
||||
|
||||
} // namespace sinks
|
||||
} // namespace spdlog
|
||||
|
||||
|
@@ -81,4 +81,3 @@ template<typename Factory = spdlog::synchronous_factory>
|
||||
std::shared_ptr<logger> stderr_logger_st(const std::string &logger_name);
|
||||
|
||||
} // namespace spdlog
|
||||
|
||||
|
Reference in New Issue
Block a user