mirror of
https://github.com/gabime/spdlog.git
synced 2025-11-16 09:28:56 +08:00
formatting
This commit is contained in:
@@ -50,7 +50,8 @@ inline void spdlog::logger::set_pattern(const std::string &pattern, pattern_time
|
||||
_set_pattern(pattern, pattern_time);
|
||||
}
|
||||
|
||||
template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl, const char *fmt, const Args &... args)
|
||||
template<typename... Args>
|
||||
inline void spdlog::logger::log(level::level_enum lvl, const char *fmt, const Args &... args)
|
||||
{
|
||||
if (!should_log(lvl))
|
||||
return;
|
||||
@@ -77,7 +78,8 @@ template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl
|
||||
}
|
||||
}
|
||||
|
||||
template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl, const char *msg)
|
||||
template<typename... Args>
|
||||
inline void spdlog::logger::log(level::level_enum lvl, const char *msg)
|
||||
{
|
||||
if (!should_log(lvl))
|
||||
return;
|
||||
@@ -98,7 +100,8 @@ template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T> inline void spdlog::logger::log(level::level_enum lvl, const T &msg)
|
||||
template<typename T>
|
||||
inline void spdlog::logger::log(level::level_enum lvl, const T &msg)
|
||||
{
|
||||
if (!should_log(lvl))
|
||||
return;
|
||||
@@ -119,62 +122,74 @@ template<typename T> inline void spdlog::logger::log(level::level_enum lvl, cons
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Arg1, typename... Args> inline void spdlog::logger::trace(const char *fmt, const Arg1 &arg1, const Args &... args)
|
||||
template<typename Arg1, typename... Args>
|
||||
inline void spdlog::logger::trace(const char *fmt, const Arg1 &arg1, const Args &... args)
|
||||
{
|
||||
log(level::trace, fmt, arg1, args...);
|
||||
}
|
||||
|
||||
template<typename Arg1, typename... Args> inline void spdlog::logger::debug(const char *fmt, const Arg1 &arg1, const Args &... args)
|
||||
template<typename Arg1, typename... Args>
|
||||
inline void spdlog::logger::debug(const char *fmt, const Arg1 &arg1, const Args &... args)
|
||||
{
|
||||
log(level::debug, fmt, arg1, args...);
|
||||
}
|
||||
|
||||
template<typename Arg1, typename... Args> inline void spdlog::logger::info(const char *fmt, const Arg1 &arg1, const Args &... args)
|
||||
template<typename Arg1, typename... Args>
|
||||
inline void spdlog::logger::info(const char *fmt, const Arg1 &arg1, const Args &... args)
|
||||
{
|
||||
log(level::info, fmt, arg1, args...);
|
||||
}
|
||||
|
||||
template<typename Arg1, typename... Args> inline void spdlog::logger::warn(const char *fmt, const Arg1 &arg1, const Args &... args)
|
||||
template<typename Arg1, typename... Args>
|
||||
inline void spdlog::logger::warn(const char *fmt, const Arg1 &arg1, const Args &... args)
|
||||
{
|
||||
log(level::warn, fmt, arg1, args...);
|
||||
}
|
||||
|
||||
template<typename Arg1, typename... Args> inline void spdlog::logger::error(const char *fmt, const Arg1 &arg1, const Args &... args)
|
||||
template<typename Arg1, typename... Args>
|
||||
inline void spdlog::logger::error(const char *fmt, const Arg1 &arg1, const Args &... args)
|
||||
{
|
||||
log(level::err, fmt, arg1, args...);
|
||||
}
|
||||
|
||||
template<typename Arg1, typename... Args> inline void spdlog::logger::critical(const char *fmt, const Arg1 &arg1, const Args &... args)
|
||||
template<typename Arg1, typename... Args>
|
||||
inline void spdlog::logger::critical(const char *fmt, const Arg1 &arg1, const Args &... args)
|
||||
{
|
||||
log(level::critical, fmt, arg1, args...);
|
||||
}
|
||||
|
||||
template<typename T> inline void spdlog::logger::trace(const T &msg)
|
||||
template<typename T>
|
||||
inline void spdlog::logger::trace(const T &msg)
|
||||
{
|
||||
log(level::trace, msg);
|
||||
}
|
||||
|
||||
template<typename T> inline void spdlog::logger::debug(const T &msg)
|
||||
template<typename T>
|
||||
inline void spdlog::logger::debug(const T &msg)
|
||||
{
|
||||
log(level::debug, msg);
|
||||
}
|
||||
|
||||
template<typename T> inline void spdlog::logger::info(const T &msg)
|
||||
template<typename T>
|
||||
inline void spdlog::logger::info(const T &msg)
|
||||
{
|
||||
log(level::info, msg);
|
||||
}
|
||||
|
||||
template<typename T> inline void spdlog::logger::warn(const T &msg)
|
||||
template<typename T>
|
||||
inline void spdlog::logger::warn(const T &msg)
|
||||
{
|
||||
log(level::warn, msg);
|
||||
}
|
||||
|
||||
template<typename T> inline void spdlog::logger::error(const T &msg)
|
||||
template<typename T>
|
||||
inline void spdlog::logger::error(const T &msg)
|
||||
{
|
||||
log(level::err, msg);
|
||||
}
|
||||
|
||||
template<typename T> inline void spdlog::logger::critical(const T &msg)
|
||||
template<typename T>
|
||||
inline void spdlog::logger::critical(const T &msg)
|
||||
{
|
||||
log(level::critical, msg);
|
||||
}
|
||||
@@ -183,14 +198,16 @@ template<typename T> inline void spdlog::logger::critical(const T &msg)
|
||||
#include <codecvt>
|
||||
#include <locale>
|
||||
|
||||
template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl, const wchar_t *msg)
|
||||
template<typename... Args>
|
||||
inline void spdlog::logger::log(level::level_enum lvl, const wchar_t *msg)
|
||||
{
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>> conv;
|
||||
|
||||
log(lvl, conv.to_bytes(msg));
|
||||
}
|
||||
|
||||
template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl, const wchar_t *fmt, const Args &... args)
|
||||
template<typename... Args>
|
||||
inline void spdlog::logger::log(level::level_enum lvl, const wchar_t *fmt, const Args &... args)
|
||||
{
|
||||
fmt::WMemoryWriter wWriter;
|
||||
|
||||
@@ -198,32 +215,38 @@ template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl
|
||||
log(lvl, wWriter.c_str());
|
||||
}
|
||||
|
||||
template<typename... Args> inline void spdlog::logger::trace(const wchar_t *fmt, const Args &... args)
|
||||
template<typename... Args>
|
||||
inline void spdlog::logger::trace(const wchar_t *fmt, const Args &... args)
|
||||
{
|
||||
log(level::trace, fmt, args...);
|
||||
}
|
||||
|
||||
template<typename... Args> inline void spdlog::logger::debug(const wchar_t *fmt, const Args &... args)
|
||||
template<typename... Args>
|
||||
inline void spdlog::logger::debug(const wchar_t *fmt, const Args &... args)
|
||||
{
|
||||
log(level::debug, fmt, args...);
|
||||
}
|
||||
|
||||
template<typename... Args> inline void spdlog::logger::info(const wchar_t *fmt, const Args &... args)
|
||||
template<typename... Args>
|
||||
inline void spdlog::logger::info(const wchar_t *fmt, const Args &... args)
|
||||
{
|
||||
log(level::info, fmt, args...);
|
||||
}
|
||||
|
||||
template<typename... Args> inline void spdlog::logger::warn(const wchar_t *fmt, const Args &... args)
|
||||
template<typename... Args>
|
||||
inline void spdlog::logger::warn(const wchar_t *fmt, const Args &... args)
|
||||
{
|
||||
log(level::warn, fmt, args...);
|
||||
}
|
||||
|
||||
template<typename... Args> inline void spdlog::logger::error(const wchar_t *fmt, const Args &... args)
|
||||
template<typename... Args>
|
||||
inline void spdlog::logger::error(const wchar_t *fmt, const Args &... args)
|
||||
{
|
||||
log(level::err, fmt, args...);
|
||||
}
|
||||
|
||||
template<typename... Args> inline void spdlog::logger::critical(const wchar_t *fmt, const Args &... args)
|
||||
template<typename... Args>
|
||||
inline void spdlog::logger::critical(const wchar_t *fmt, const Args &... args)
|
||||
{
|
||||
log(level::critical, fmt, args...);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||
|
||||
namespace spdlog { namespace details {
|
||||
|
||||
template<typename T> class mpmc_bounded_queue
|
||||
template<typename T>
|
||||
class mpmc_bounded_queue
|
||||
{
|
||||
public:
|
||||
using item_type = T;
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
#include <unordered_map>
|
||||
|
||||
namespace spdlog { namespace details {
|
||||
template<class Mutex> class registry_t
|
||||
template<class Mutex>
|
||||
class registry_t
|
||||
{
|
||||
public:
|
||||
registry_t<Mutex>(const registry_t<Mutex> &) = delete;
|
||||
@@ -44,7 +45,8 @@ public:
|
||||
return found == _loggers.end() ? nullptr : found->second;
|
||||
}
|
||||
|
||||
template<class It> std::shared_ptr<logger> create(const std::string &logger_name, const It &sinks_begin, const It &sinks_end)
|
||||
template<class It>
|
||||
std::shared_ptr<logger> create(const std::string &logger_name, const It &sinks_begin, const It &sinks_end)
|
||||
{
|
||||
std::lock_guard<Mutex> lock(_mutex);
|
||||
throw_if_exists(logger_name);
|
||||
|
||||
Reference in New Issue
Block a user