Commit 4445f6f8 authored by gabime's avatar gabime

formatting

parent 4ee89877
......@@ -13,7 +13,8 @@
#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,8 @@
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 +21,8 @@ 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,8 @@
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 +21,8 @@ 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;
......
......@@ -133,7 +133,8 @@ 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,8 @@ 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,8 @@
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 +21,8 @@ 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;
......
......@@ -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);
......
This diff is collapsed.
......@@ -17,7 +17,8 @@ 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 +61,14 @@ 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
......
......@@ -20,9 +20,11 @@ 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 +35,11 @@ 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 +57,8 @@ 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 +70,8 @@ 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 +96,14 @@ 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 +114,8 @@ public:
}
};
template<typename T, typename U> struct is_same
template<typename T, typename U>
struct is_same
{
enum
{
......@@ -114,7 +123,8 @@ 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 +136,8 @@ 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 +164,8 @@ 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 +223,8 @@ 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 +251,8 @@ 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 +286,8 @@ 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 +382,8 @@ 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 +394,8 @@ 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 +427,8 @@ 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 +456,8 @@ template<typename Char, typename AF> void PrintfFormatter<Char, AF>::parse_flags
}
}
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 +467,8 @@ template<typename Char, typename AF> internal::Arg PrintfFormatter<Char, AF>::ge
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 +509,8 @@ template<typename Char, typename AF> unsigned PrintfFormatter<Char, AF>::parse_h
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,8 @@
#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,84 @@ 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 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 critical(const T &msg);
bool should_log(level::level_enum msg_level) const;
void set_level(level::level_enum log_level);
......
......@@ -19,7 +19,8 @@ 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 +107,8 @@ 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 +120,8 @@ 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,8 @@
#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,8 @@
// 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,8 @@ 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 +61,8 @@ 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 +187,8 @@ 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,8 @@ 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,8 @@
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,8 @@
#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,8 @@
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 +44,8 @@ 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,8 @@ 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 +90,8 @@ 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 +106,8 @@ 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,8 @@ 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;
......
......@@ -81,6 +81,7 @@ std::shared_ptr<logger> basic_logger_st(const std::string &logger_name, const fi
//
std::shared_ptr<logger> rotating_logger_mt(
const std::string &logger_name, const filename_t &filename, size_t max_file_size, size_t max_files);
std::shared_ptr<logger> rotating_logger_st(
const std::string &logger_name, const filename_t &filename, size_t max_file_size, size_t max_files);
......@@ -122,12 +123,15 @@ 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,6 +146,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>
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,
......
#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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment