mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-24 09:31:34 +08:00
Changed clang formatting for templates
This commit is contained in:
parent
f4ce52d206
commit
5afb5dc782
@ -13,7 +13,7 @@
|
||||
#include "g2logworker.h"
|
||||
|
||||
using namespace std;
|
||||
template <typename T> std::string format(const T &value);
|
||||
template<typename T> std::string format(const T &value);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
namespace utils {
|
||||
|
||||
template <typename T> inline std::string format(const T &value)
|
||||
template<typename T> inline std::string format(const T &value)
|
||||
{
|
||||
static std::locale loc("");
|
||||
std::stringstream ss;
|
||||
@ -20,7 +20,7 @@ template <typename T> inline std::string format(const T &value)
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
template <> inline std::string format(const double &value)
|
||||
template<> inline std::string format(const double &value)
|
||||
{
|
||||
static std::locale loc("");
|
||||
std::stringstream ss;
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
namespace utils {
|
||||
|
||||
template <typename T> inline std::string format(const T &value)
|
||||
template<typename T> inline std::string format(const T &value)
|
||||
{
|
||||
static std::locale loc("");
|
||||
std::stringstream ss;
|
||||
@ -20,7 +20,7 @@ template <typename T> inline std::string format(const T &value)
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
template <> inline std::string format(const double &value)
|
||||
template<> inline std::string format(const double &value)
|
||||
{
|
||||
static std::locale loc("");
|
||||
std::stringstream ss;
|
||||
|
@ -24,6 +24,12 @@ void err_handler_example();
|
||||
namespace spd = spdlog;
|
||||
int main(int, char *[])
|
||||
{
|
||||
fmt::MemoryWriter w;
|
||||
w.write("HELLO", 10);
|
||||
std::string s(w.data(), w.size());
|
||||
std::cout << s << std::endl;
|
||||
return 0;
|
||||
|
||||
try
|
||||
{
|
||||
// Console logger with color
|
||||
@ -133,7 +139,7 @@ void android_example()
|
||||
struct my_type
|
||||
{
|
||||
int i;
|
||||
template <typename OStream> friend OStream &operator<<(OStream &os, const my_type &c)
|
||||
template<typename OStream> friend OStream &operator<<(OStream &os, const my_type &c)
|
||||
{
|
||||
return os << "[my_type i=" << c.i << "]";
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ void android_example()
|
||||
struct my_type
|
||||
{
|
||||
int i;
|
||||
template <typename OStream> friend OStream &operator<<(OStream &os, const my_type &c)
|
||||
template<typename OStream> friend OStream &operator<<(OStream &os, const my_type &c)
|
||||
{
|
||||
return os << "[my_type i=" << c.i << "]";
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
namespace utils {
|
||||
|
||||
template <typename T> inline std::string format(const T &value)
|
||||
template<typename T> inline std::string format(const T &value)
|
||||
{
|
||||
static std::locale loc("");
|
||||
std::stringstream ss;
|
||||
@ -20,7 +20,7 @@ template <typename T> inline std::string format(const T &value)
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
template <> inline std::string format(const double &value)
|
||||
template<> inline std::string format(const double &value)
|
||||
{
|
||||
static std::locale loc("");
|
||||
std::stringstream ss;
|
||||
|
@ -32,7 +32,7 @@ class async_log_helper;
|
||||
class async_logger SPDLOG_FINAL : public logger
|
||||
{
|
||||
public:
|
||||
template <class It>
|
||||
template<class It>
|
||||
async_logger(const std::string &logger_name, const It &begin, const It &end, size_t queue_size,
|
||||
const async_overflow_policy overflow_policy = async_overflow_policy::block_retry,
|
||||
const std::function<void()> &worker_warmup_cb = nullptr,
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
template <class It>
|
||||
template<class It>
|
||||
inline spdlog::async_logger::async_logger(const std::string &logger_name, const It &begin, const It &end, size_t queue_size,
|
||||
const async_overflow_policy overflow_policy, const std::function<void()> &worker_warmup_cb,
|
||||
const std::chrono::milliseconds &flush_interval_ms, const std::function<void()> &worker_teardown_cb)
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
// create logger with given name, sinks and the default pattern formatter
|
||||
// all other ctors will call this one
|
||||
template <class It>
|
||||
template<class It>
|
||||
inline spdlog::logger::logger(std::string logger_name, const It &begin, const It &end)
|
||||
: _name(std::move(logger_name))
|
||||
, _sinks(begin, end)
|
||||
@ -50,7 +50,7 @@ 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 +77,7 @@ template <typename... Args> inline void spdlog::logger::log(level::level_enum lv
|
||||
}
|
||||
}
|
||||
|
||||
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 +98,7 @@ template <typename... Args> inline void spdlog::logger::log(level::level_enum lv
|
||||
}
|
||||
}
|
||||
|
||||
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 +119,62 @@ template <typename T> inline void spdlog::logger::log(level::level_enum lvl, con
|
||||
}
|
||||
}
|
||||
|
||||
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 +183,14 @@ 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 +198,32 @@ template <typename... Args> inline void spdlog::logger::log(level::level_enum lv
|
||||
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,7 @@ 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,7 @@
|
||||
#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 +44,7 @@ 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);
|
||||
@ -69,7 +69,7 @@ public:
|
||||
return new_logger;
|
||||
}
|
||||
|
||||
template <class It>
|
||||
template<class It>
|
||||
std::shared_ptr<async_logger> create_async(const std::string &logger_name, size_t queue_size,
|
||||
const async_overflow_policy overflow_policy, const std::function<void()> &worker_warmup_cb,
|
||||
const std::chrono::milliseconds &flush_interval_ms, const std::function<void()> &worker_teardown_cb, const It &sinks_begin,
|
||||
|
@ -190,14 +190,14 @@ inline std::shared_ptr<spdlog::logger> spdlog::create(const std::string &logger_
|
||||
return details::registry::instance().create(logger_name, sinks);
|
||||
}
|
||||
|
||||
template <typename Sink, typename... Args>
|
||||
template<typename Sink, typename... Args>
|
||||
inline std::shared_ptr<spdlog::logger> spdlog::create(const std::string &logger_name, Args... args)
|
||||
{
|
||||
sink_ptr sink = std::make_shared<Sink>(args...);
|
||||
return details::registry::instance().create(logger_name, {sink});
|
||||
}
|
||||
|
||||
template <class It>
|
||||
template<class It>
|
||||
inline std::shared_ptr<spdlog::logger> spdlog::create(const std::string &logger_name, const It &sinks_begin, const It &sinks_end)
|
||||
{
|
||||
return details::registry::instance().create(logger_name, sinks_begin, sinks_end);
|
||||
@ -221,7 +221,7 @@ inline std::shared_ptr<spdlog::logger> spdlog::create_async(const std::string &l
|
||||
logger_name, queue_size, overflow_policy, worker_warmup_cb, flush_interval_ms, worker_teardown_cb, sinks);
|
||||
}
|
||||
|
||||
template <class It>
|
||||
template<class It>
|
||||
inline std::shared_ptr<spdlog::logger> spdlog::create_async(const std::string &logger_name, const It &sinks_begin, const It &sinks_end,
|
||||
size_t queue_size, const async_overflow_policy overflow_policy, const std::function<void()> &worker_warmup_cb,
|
||||
const std::chrono::milliseconds &flush_interval_ms, const std::function<void()> &worker_teardown_cb)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -17,7 +17,7 @@ namespace fmt {
|
||||
|
||||
namespace internal {
|
||||
|
||||
template <class Char> class FormatBuf : public std::basic_streambuf<Char>
|
||||
template<class Char> class FormatBuf : public std::basic_streambuf<Char>
|
||||
{
|
||||
private:
|
||||
typedef typename std::basic_streambuf<Char>::int_type int_type;
|
||||
@ -60,12 +60,12 @@ struct DummyStream : std::ostream
|
||||
DummyStream(); // Suppress a bogus warning in MSVC.
|
||||
|
||||
// Hide all operator<< overloads from std::ostream.
|
||||
template <typename T> typename EnableIf<sizeof(T) == 0>::type operator<<(const T &);
|
||||
template<typename T> typename EnableIf<sizeof(T) == 0>::type operator<<(const T &);
|
||||
};
|
||||
|
||||
No &operator<<(std::ostream &, int);
|
||||
|
||||
template <typename T> struct ConvertToIntImpl<T, true>
|
||||
template<typename T> struct ConvertToIntImpl<T, true>
|
||||
{
|
||||
// Convert to int only if T doesn't have an overloaded operator<<.
|
||||
enum
|
||||
@ -79,7 +79,7 @@ FMT_API void write(std::ostream &os, Writer &w);
|
||||
} // namespace internal
|
||||
|
||||
// Formats a value.
|
||||
template <typename Char, typename ArgFormatter_, typename T>
|
||||
template<typename Char, typename ArgFormatter_, typename T>
|
||||
void format_arg(BasicFormatter<Char, ArgFormatter_> &f, const Char *&format_str, const T &value)
|
||||
{
|
||||
internal::MemoryBuffer<Char, internal::INLINE_BUFFER_SIZE> buffer;
|
||||
|
@ -20,9 +20,9 @@ namespace internal {
|
||||
|
||||
// Checks if a value fits in int - used to avoid warnings about comparing
|
||||
// signed and unsigned integers.
|
||||
template <bool IsSigned> struct IntChecker
|
||||
template<bool IsSigned> struct IntChecker
|
||||
{
|
||||
template <typename T> static bool fits_in_int(T value)
|
||||
template<typename T> static bool fits_in_int(T value)
|
||||
{
|
||||
unsigned max = std::numeric_limits<int>::max();
|
||||
return value <= max;
|
||||
@ -33,9 +33,9 @@ template <bool IsSigned> struct IntChecker
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct IntChecker<true>
|
||||
template<> struct IntChecker<true>
|
||||
{
|
||||
template <typename T> static bool fits_in_int(T value)
|
||||
template<typename T> static bool fits_in_int(T value)
|
||||
{
|
||||
return value >= std::numeric_limits<int>::min() && value <= std::numeric_limits<int>::max();
|
||||
}
|
||||
@ -53,7 +53,7 @@ public:
|
||||
FMT_THROW(FormatError("precision is not integer"));
|
||||
}
|
||||
|
||||
template <typename T> int visit_any_int(T value)
|
||||
template<typename T> int visit_any_int(T value)
|
||||
{
|
||||
if (!IntChecker<std::numeric_limits<T>::is_signed>::fits_in_int(value))
|
||||
FMT_THROW(FormatError("number is too big"));
|
||||
@ -65,7 +65,7 @@ public:
|
||||
class IsZeroInt : public ArgVisitor<IsZeroInt, bool>
|
||||
{
|
||||
public:
|
||||
template <typename T> bool visit_any_int(T value)
|
||||
template<typename T> bool visit_any_int(T value)
|
||||
{
|
||||
return value == 0;
|
||||
}
|
||||
@ -90,12 +90,12 @@ public:
|
||||
return 'p';
|
||||
}
|
||||
|
||||
template <typename T> char visit_any_int(T)
|
||||
template<typename T> char visit_any_int(T)
|
||||
{
|
||||
return 'd';
|
||||
}
|
||||
|
||||
template <typename T> char visit_any_double(T)
|
||||
template<typename T> char visit_any_double(T)
|
||||
{
|
||||
return 'g';
|
||||
}
|
||||
@ -106,7 +106,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename U> struct is_same
|
||||
template<typename T, typename U> struct is_same
|
||||
{
|
||||
enum
|
||||
{
|
||||
@ -114,7 +114,7 @@ template <typename T, typename U> struct is_same
|
||||
};
|
||||
};
|
||||
|
||||
template <typename T> struct is_same<T, T>
|
||||
template<typename T> struct is_same<T, T>
|
||||
{
|
||||
enum
|
||||
{
|
||||
@ -126,7 +126,7 @@ template <typename T> struct is_same<T, T>
|
||||
// if T is an integral type. If T is void, the argument is converted to
|
||||
// corresponding signed or unsigned type depending on the type specifier:
|
||||
// 'd' and 'i' - signed, other - unsigned)
|
||||
template <typename T = void> class ArgConverter : public ArgVisitor<ArgConverter<T>, void>
|
||||
template<typename T = void> class ArgConverter : public ArgVisitor<ArgConverter<T>, void>
|
||||
{
|
||||
private:
|
||||
internal::Arg &arg_;
|
||||
@ -153,7 +153,7 @@ public:
|
||||
visit_any_int(value);
|
||||
}
|
||||
|
||||
template <typename U> void visit_any_int(U value)
|
||||
template<typename U> void visit_any_int(U value)
|
||||
{
|
||||
bool is_signed = type_ == 'd' || type_ == 'i';
|
||||
if (type_ == 's')
|
||||
@ -211,7 +211,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T> void visit_any_int(T value)
|
||||
template<typename T> void visit_any_int(T value)
|
||||
{
|
||||
arg_.type = internal::Arg::CHAR;
|
||||
arg_.int_value = static_cast<char>(value);
|
||||
@ -238,7 +238,7 @@ public:
|
||||
FMT_THROW(FormatError("width is not integer"));
|
||||
}
|
||||
|
||||
template <typename T> unsigned visit_any_int(T value)
|
||||
template<typename T> unsigned visit_any_int(T value)
|
||||
{
|
||||
typedef typename internal::IntTraits<T>::MainType UnsignedType;
|
||||
UnsignedType width = static_cast<UnsignedType>(value);
|
||||
@ -272,7 +272,7 @@ public:
|
||||
superclass will be called.
|
||||
\endrst
|
||||
*/
|
||||
template <typename Impl, typename Char, typename Spec> class BasicPrintfArgFormatter : public internal::ArgFormatterBase<Impl, Char, Spec>
|
||||
template<typename Impl, typename Char, typename Spec> class BasicPrintfArgFormatter : public internal::ArgFormatterBase<Impl, Char, Spec>
|
||||
{
|
||||
private:
|
||||
void write_null_pointer()
|
||||
@ -367,7 +367,7 @@ public:
|
||||
};
|
||||
|
||||
/** The default printf argument formatter. */
|
||||
template <typename Char> class PrintfArgFormatter : public BasicPrintfArgFormatter<PrintfArgFormatter<Char>, Char, FormatSpec>
|
||||
template<typename Char> class PrintfArgFormatter : public BasicPrintfArgFormatter<PrintfArgFormatter<Char>, Char, FormatSpec>
|
||||
{
|
||||
public:
|
||||
/** Constructs an argument formatter object. */
|
||||
@ -378,7 +378,7 @@ public:
|
||||
};
|
||||
|
||||
/** This template formats data and writes the output to a writer. */
|
||||
template <typename Char, typename ArgFormatter = PrintfArgFormatter<Char>> class PrintfFormatter : private internal::FormatterBase
|
||||
template<typename Char, typename ArgFormatter = PrintfArgFormatter<Char>> class PrintfFormatter : private internal::FormatterBase
|
||||
{
|
||||
private:
|
||||
BasicWriter<Char> &writer_;
|
||||
@ -410,7 +410,7 @@ public:
|
||||
void format(BasicCStringRef<Char> format_str);
|
||||
};
|
||||
|
||||
template <typename Char, typename AF> void PrintfFormatter<Char, AF>::parse_flags(FormatSpec &spec, const Char *&s)
|
||||
template<typename Char, typename AF> void PrintfFormatter<Char, AF>::parse_flags(FormatSpec &spec, const Char *&s)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
@ -438,7 +438,7 @@ template <typename Char, typename AF> void PrintfFormatter<Char, AF>::parse_flag
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Char, typename AF> internal::Arg PrintfFormatter<Char, AF>::get_arg(const Char *s, unsigned arg_index)
|
||||
template<typename Char, typename AF> internal::Arg PrintfFormatter<Char, AF>::get_arg(const Char *s, unsigned arg_index)
|
||||
{
|
||||
(void)s;
|
||||
const char *error = FMT_NULL;
|
||||
@ -448,7 +448,7 @@ template <typename Char, typename AF> internal::Arg PrintfFormatter<Char, AF>::g
|
||||
return arg;
|
||||
}
|
||||
|
||||
template <typename Char, typename AF> unsigned PrintfFormatter<Char, AF>::parse_header(const Char *&s, FormatSpec &spec)
|
||||
template<typename Char, typename AF> unsigned PrintfFormatter<Char, AF>::parse_header(const Char *&s, FormatSpec &spec)
|
||||
{
|
||||
unsigned arg_index = std::numeric_limits<unsigned>::max();
|
||||
Char c = *s;
|
||||
@ -489,7 +489,7 @@ template <typename Char, typename AF> unsigned PrintfFormatter<Char, AF>::parse_
|
||||
return arg_index;
|
||||
}
|
||||
|
||||
template <typename Char, typename AF> void PrintfFormatter<Char, AF>::format(BasicCStringRef<Char> format_str)
|
||||
template<typename Char, typename AF> void PrintfFormatter<Char, AF>::format(BasicCStringRef<Char> format_str)
|
||||
{
|
||||
const Char *start = format_str.c_str();
|
||||
const Char *s = start;
|
||||
|
@ -20,7 +20,7 @@
|
||||
#endif
|
||||
|
||||
namespace fmt {
|
||||
template <typename ArgFormatter> void format_arg(BasicFormatter<char, ArgFormatter> &f, const char *&format_str, const std::tm &tm)
|
||||
template<typename ArgFormatter> void format_arg(BasicFormatter<char, ArgFormatter> &f, const char *&format_str, const std::tm &tm)
|
||||
{
|
||||
if (*format_str == ':')
|
||||
++format_str;
|
||||
|
@ -27,40 +27,40 @@ public:
|
||||
logger(const std::string &name, sink_ptr single_sink);
|
||||
logger(const std::string &name, sinks_init_list sinks);
|
||||
|
||||
template <class It> logger(std::string name, const It &begin, const It &end);
|
||||
template<class It> logger(std::string name, const It &begin, const It &end);
|
||||
|
||||
virtual ~logger();
|
||||
|
||||
logger(const logger &) = delete;
|
||||
logger &operator=(const logger &) = delete;
|
||||
|
||||
template <typename... Args> void log(level::level_enum lvl, const char *fmt, const Args &... args);
|
||||
template <typename... Args> void log(level::level_enum lvl, const char *msg);
|
||||
template <typename Arg1, typename... Args> void trace(const char *fmt, const Arg1 &, const Args &... args);
|
||||
template <typename Arg1, typename... Args> void debug(const char *fmt, const Arg1 &, const Args &... args);
|
||||
template <typename Arg1, typename... Args> void info(const char *fmt, const Arg1 &, const Args &... args);
|
||||
template <typename Arg1, typename... Args> void warn(const char *fmt, const Arg1 &, const Args &... args);
|
||||
template <typename Arg1, typename... Args> void error(const char *fmt, const Arg1 &, const Args &... args);
|
||||
template <typename Arg1, typename... Args> void critical(const char *fmt, const Arg1 &, const Args &... args);
|
||||
template<typename... Args> void log(level::level_enum lvl, const char *fmt, const Args &... args);
|
||||
template<typename... Args> void log(level::level_enum lvl, const char *msg);
|
||||
template<typename Arg1, typename... Args> void trace(const char *fmt, const Arg1 &, const Args &... args);
|
||||
template<typename Arg1, typename... Args> void debug(const char *fmt, const Arg1 &, const Args &... args);
|
||||
template<typename Arg1, typename... Args> void info(const char *fmt, const Arg1 &, const Args &... args);
|
||||
template<typename Arg1, typename... Args> void warn(const char *fmt, const Arg1 &, const Args &... args);
|
||||
template<typename Arg1, typename... Args> void error(const char *fmt, const Arg1 &, const Args &... args);
|
||||
template<typename Arg1, typename... Args> void critical(const char *fmt, const Arg1 &, const Args &... args);
|
||||
|
||||
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
|
||||
template <typename... Args> void log(level::level_enum lvl, const wchar_t *msg);
|
||||
template <typename... Args> void log(level::level_enum lvl, const wchar_t *fmt, const Args &... args);
|
||||
template <typename... Args> void trace(const wchar_t *fmt, const Args &... args);
|
||||
template <typename... Args> void debug(const wchar_t *fmt, const Args &... args);
|
||||
template <typename... Args> void info(const wchar_t *fmt, const Args &... args);
|
||||
template <typename... Args> void warn(const wchar_t *fmt, const Args &... args);
|
||||
template <typename... Args> void error(const wchar_t *fmt, const Args &... args);
|
||||
template <typename... Args> void critical(const wchar_t *fmt, const Args &... args);
|
||||
template<typename... Args> void log(level::level_enum lvl, const wchar_t *msg);
|
||||
template<typename... Args> void log(level::level_enum lvl, const wchar_t *fmt, const Args &... args);
|
||||
template<typename... Args> void trace(const wchar_t *fmt, const Args &... args);
|
||||
template<typename... Args> void debug(const wchar_t *fmt, const Args &... args);
|
||||
template<typename... Args> void info(const wchar_t *fmt, const Args &... args);
|
||||
template<typename... Args> void warn(const wchar_t *fmt, const Args &... args);
|
||||
template<typename... Args> void error(const wchar_t *fmt, const Args &... args);
|
||||
template<typename... Args> void critical(const wchar_t *fmt, const Args &... args);
|
||||
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
|
||||
|
||||
template <typename T> void log(level::level_enum lvl, const T &);
|
||||
template <typename T> void trace(const T &msg);
|
||||
template <typename T> void debug(const T &msg);
|
||||
template <typename T> void info(const T &msg);
|
||||
template <typename T> void warn(const T &msg);
|
||||
template <typename T> void error(const T &msg);
|
||||
template <typename T> void critical(const T &msg);
|
||||
template<typename T> void log(level::level_enum lvl, const T &);
|
||||
template<typename T> void trace(const T &msg);
|
||||
template<typename T> void debug(const T &msg);
|
||||
template<typename T> void info(const T &msg);
|
||||
template<typename T> void warn(const T &msg);
|
||||
template<typename T> void error(const T &msg);
|
||||
template<typename T> void critical(const T &msg);
|
||||
|
||||
bool should_log(level::level_enum msg_level) const;
|
||||
void set_level(level::level_enum log_level);
|
||||
|
@ -19,7 +19,7 @@ namespace spdlog { namespace sinks {
|
||||
* of the message.
|
||||
* If no color terminal detected, omit the escape codes.
|
||||
*/
|
||||
template <class Mutex> class ansicolor_sink : public base_sink<Mutex>
|
||||
template<class Mutex> class ansicolor_sink : public base_sink<Mutex>
|
||||
{
|
||||
public:
|
||||
explicit ansicolor_sink(FILE *file)
|
||||
@ -106,7 +106,7 @@ protected:
|
||||
std::unordered_map<level::level_enum, std::string, level::level_hasher> colors_;
|
||||
};
|
||||
|
||||
template <class Mutex> class ansicolor_stdout_sink : public ansicolor_sink<Mutex>
|
||||
template<class Mutex> class ansicolor_stdout_sink : public ansicolor_sink<Mutex>
|
||||
{
|
||||
public:
|
||||
ansicolor_stdout_sink()
|
||||
@ -118,7 +118,7 @@ public:
|
||||
using ansicolor_stdout_sink_mt = ansicolor_stdout_sink<std::mutex>;
|
||||
using ansicolor_stdout_sink_st = ansicolor_stdout_sink<details::null_mutex>;
|
||||
|
||||
template <class Mutex> class ansicolor_stderr_sink : public ansicolor_sink<Mutex>
|
||||
template<class Mutex> class ansicolor_stderr_sink : public ansicolor_sink<Mutex>
|
||||
{
|
||||
public:
|
||||
ansicolor_stderr_sink()
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <mutex>
|
||||
|
||||
namespace spdlog { namespace sinks {
|
||||
template <class Mutex> class base_sink : public sink
|
||||
template<class Mutex> class base_sink : public sink
|
||||
{
|
||||
public:
|
||||
base_sink() = default;
|
||||
|
@ -18,7 +18,7 @@
|
||||
// Distribution sink (mux). Stores a vector of sinks which get called when log is called
|
||||
|
||||
namespace spdlog { namespace sinks {
|
||||
template <class Mutex> class dist_sink : public base_sink<Mutex>
|
||||
template<class Mutex> class dist_sink : public base_sink<Mutex>
|
||||
{
|
||||
public:
|
||||
explicit dist_sink()
|
||||
|
@ -22,7 +22,7 @@ namespace spdlog { namespace sinks {
|
||||
/*
|
||||
* Trivial file sink with single file as target
|
||||
*/
|
||||
template <class Mutex> class simple_file_sink SPDLOG_FINAL : public base_sink<Mutex>
|
||||
template<class Mutex> class simple_file_sink SPDLOG_FINAL : public base_sink<Mutex>
|
||||
{
|
||||
public:
|
||||
explicit simple_file_sink(const filename_t &filename, bool truncate = false)
|
||||
@ -60,7 +60,7 @@ using simple_file_sink_st = simple_file_sink<details::null_mutex>;
|
||||
/*
|
||||
* Rotating file sink based on size
|
||||
*/
|
||||
template <class Mutex> class rotating_file_sink SPDLOG_FINAL : public base_sink<Mutex>
|
||||
template<class Mutex> class rotating_file_sink SPDLOG_FINAL : public base_sink<Mutex>
|
||||
{
|
||||
public:
|
||||
rotating_file_sink(filename_t base_filename, std::size_t max_size, std::size_t max_files)
|
||||
@ -185,7 +185,7 @@ struct dateonly_daily_file_name_calculator
|
||||
/*
|
||||
* Rotating file sink based on date. rotates at midnight
|
||||
*/
|
||||
template <class Mutex, class FileNameCalc = default_daily_file_name_calculator> class daily_file_sink SPDLOG_FINAL : public base_sink<Mutex>
|
||||
template<class Mutex, class FileNameCalc = default_daily_file_name_calculator> class daily_file_sink SPDLOG_FINAL : public base_sink<Mutex>
|
||||
{
|
||||
public:
|
||||
// create daily file sink which rotates on given time
|
||||
|
@ -19,7 +19,7 @@ namespace spdlog { namespace sinks {
|
||||
/*
|
||||
* MSVC sink (logging using OutputDebugStringA)
|
||||
*/
|
||||
template <class Mutex> class msvc_sink : public base_sink<Mutex>
|
||||
template<class Mutex> class msvc_sink : public base_sink<Mutex>
|
||||
{
|
||||
public:
|
||||
explicit msvc_sink() {}
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
namespace spdlog { namespace sinks {
|
||||
|
||||
template <class Mutex> class null_sink : public base_sink<Mutex>
|
||||
template<class Mutex> class null_sink : public base_sink<Mutex>
|
||||
{
|
||||
protected:
|
||||
void _sink_it(const details::log_msg &) override {}
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <ostream>
|
||||
|
||||
namespace spdlog { namespace sinks {
|
||||
template <class Mutex> class ostream_sink : public base_sink<Mutex>
|
||||
template<class Mutex> class ostream_sink : public base_sink<Mutex>
|
||||
{
|
||||
public:
|
||||
explicit ostream_sink(std::ostream &os, bool force_flush = false)
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
namespace spdlog { namespace sinks {
|
||||
|
||||
template <class Mutex> class stdout_sink SPDLOG_FINAL : public base_sink<Mutex>
|
||||
template<class Mutex> class stdout_sink SPDLOG_FINAL : public base_sink<Mutex>
|
||||
{
|
||||
using MyType = stdout_sink<Mutex>;
|
||||
|
||||
@ -43,7 +43,7 @@ protected:
|
||||
using stdout_sink_mt = stdout_sink<std::mutex>;
|
||||
using stdout_sink_st = stdout_sink<details::null_mutex>;
|
||||
|
||||
template <class Mutex> class stderr_sink SPDLOG_FINAL : public base_sink<Mutex>
|
||||
template<class Mutex> class stderr_sink SPDLOG_FINAL : public base_sink<Mutex>
|
||||
{
|
||||
using MyType = stderr_sink<Mutex>;
|
||||
|
||||
|
@ -18,7 +18,7 @@ namespace spdlog { namespace sinks {
|
||||
/*
|
||||
* Windows color console sink. Uses WriteConsoleA to write to the console with colors
|
||||
*/
|
||||
template <class Mutex> class wincolor_sink : public base_sink<Mutex>
|
||||
template<class Mutex> class wincolor_sink : public base_sink<Mutex>
|
||||
{
|
||||
public:
|
||||
const WORD BOLD = FOREGROUND_INTENSITY;
|
||||
@ -89,7 +89,7 @@ private:
|
||||
//
|
||||
// windows color console to stdout
|
||||
//
|
||||
template <class Mutex> class wincolor_stdout_sink : public wincolor_sink<Mutex>
|
||||
template<class Mutex> class wincolor_stdout_sink : public wincolor_sink<Mutex>
|
||||
{
|
||||
public:
|
||||
wincolor_stdout_sink()
|
||||
@ -104,7 +104,7 @@ using wincolor_stdout_sink_st = wincolor_stdout_sink<details::null_mutex>;
|
||||
//
|
||||
// windows color console to stderr
|
||||
//
|
||||
template <class Mutex> class wincolor_stderr_sink : public wincolor_sink<Mutex>
|
||||
template<class Mutex> class wincolor_stderr_sink : public wincolor_sink<Mutex>
|
||||
{
|
||||
public:
|
||||
wincolor_stderr_sink()
|
||||
|
@ -14,7 +14,7 @@ namespace spdlog { namespace sinks {
|
||||
/*
|
||||
* Windows debug sink (logging using OutputDebugStringA, synonym for msvc_sink)
|
||||
*/
|
||||
template <class Mutex> using windebug_sink = msvc_sink<Mutex>;
|
||||
template<class Mutex> using windebug_sink = msvc_sink<Mutex>;
|
||||
|
||||
using windebug_sink_mt = msvc_sink_mt;
|
||||
using windebug_sink_st = msvc_sink_st;
|
||||
|
@ -122,12 +122,12 @@ std::shared_ptr<logger> create(const std::string &logger_name, const sink_ptr &s
|
||||
|
||||
// Create and register a logger with multiple sinks
|
||||
std::shared_ptr<logger> create(const std::string &logger_name, sinks_init_list sinks);
|
||||
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);
|
||||
|
||||
// Create and register a logger with templated sink type
|
||||
// Example:
|
||||
// spdlog::create<daily_file_sink_st>("mylog", "dailylog_filename");
|
||||
template <typename Sink, typename... Args> std::shared_ptr<spdlog::logger> create(const std::string &logger_name, Args... args);
|
||||
template<typename Sink, typename... Args> std::shared_ptr<spdlog::logger> create(const std::string &logger_name, Args... args);
|
||||
|
||||
// Create and register an async logger with a single sink
|
||||
std::shared_ptr<logger> create_async(const std::string &logger_name, const sink_ptr &sink, size_t queue_size,
|
||||
@ -142,7 +142,7 @@ std::shared_ptr<logger> create_async(const std::string &logger_name, sinks_init_
|
||||
const std::function<void()> &worker_warmup_cb = nullptr,
|
||||
const std::chrono::milliseconds &flush_interval_ms = std::chrono::milliseconds::zero(),
|
||||
const std::function<void()> &worker_teardown_cb = nullptr);
|
||||
template <class It>
|
||||
template<class It>
|
||||
std::shared_ptr<logger> create_async(const std::string &logger_name, const It &sinks_begin, const It &sinks_end, size_t queue_size,
|
||||
const async_overflow_policy overflow_policy = async_overflow_policy::block_retry,
|
||||
const std::function<void()> &worker_warmup_cb = nullptr,
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "includes.h"
|
||||
|
||||
template <class T> std::string log_info(const T &what, spdlog::level::level_enum logger_level = spdlog::level::info)
|
||||
template<class T> std::string log_info(const T &what, spdlog::level::level_enum logger_level = spdlog::level::info)
|
||||
{
|
||||
|
||||
std::ostringstream oss;
|
||||
|
Loading…
Reference in New Issue
Block a user