fixed macros and other stuff for the no-streams branch

This commit is contained in:
gabime
2016-07-09 00:46:00 +03:00
parent 7885aa478c
commit 7ddfb2b877
8 changed files with 44 additions and 86 deletions

View File

@@ -19,7 +19,7 @@ namespace details
struct log_msg
{
log_msg() = default;
log_msg(std::string *loggers_name, level::level_enum lvl) : logger_name(loggers_name), level(lvl)
log_msg(const std::string *loggers_name, level::level_enum lvl) : logger_name(loggers_name), level(lvl)
{
#ifndef SPDLOG_NO_DATETIME
time = os::now();
@@ -35,7 +35,7 @@ struct log_msg
log_msg(log_msg&& other) = delete;
std::string *logger_name;
const std::string *logger_name;
level::level_enum level;
log_clock::time_point time;
size_t thread_id;

View File

@@ -31,8 +31,7 @@ inline spdlog::logger::logger(const std::string& logger_name, sinks_init_list si
// ctor with single sink
inline spdlog::logger::logger(const std::string& logger_name, spdlog::sink_ptr single_sink) :
logger(logger_name,
{
logger(logger_name, {
single_sink
}) {}
@@ -54,8 +53,7 @@ inline void spdlog::logger::set_pattern(const std::string& pattern)
template <typename... Args>
inline void spdlog::logger::log(level::level_enum lvl, const char* fmt, const Args&... args)
{
if (!should_log(lvl))
return;
if (!should_log(lvl)) return;
details::log_msg log_msg(&_name, lvl);
try
@@ -75,9 +73,7 @@ inline void spdlog::logger::log(level::level_enum lvl, const char* fmt, const Ar
template <typename... Args>
inline void spdlog::logger::log(level::level_enum lvl, const char* msg)
{
if (!should_log(lvl))
return;
if (!should_log(lvl)) return;
details::log_msg log_msg(&_name, lvl);
log_msg.raw << msg;
@@ -89,10 +85,9 @@ inline void spdlog::logger::log(level::level_enum lvl, const char* msg)
template<typename T>
inline void spdlog::logger::log(level::level_enum lvl, const T& msg)
{
if (!should_log(lvl))
return;
details::log_msg log_msg(&_name, lvl);
if (!should_log(lvl)) return;
details::log_msg log_msg(&_name, lvl);
log_msg.raw << msg;
_formatter->format(log_msg);
_sink_it(log_msg);
@@ -118,11 +113,6 @@ inline void spdlog::logger::info(const char* fmt, const Args&... args)
log(level::info, fmt, args...);
}
template <typename... Args>
inline void spdlog::logger::notice(const char* fmt, const Args&... args)
{
log(level::notice, fmt, args...);
}
template <typename... Args>
inline void spdlog::logger::warn(const char* fmt, const Args&... args)
@@ -142,19 +132,6 @@ inline void spdlog::logger::critical(const char* fmt, const Args&... args)
log(level::critical, fmt, args...);
}
template <typename... Args>
inline void spdlog::logger::alert(const char* fmt, const Args&... args)
{
log(level::alert, fmt, args...);
}
template <typename... Args>
inline void spdlog::logger::emerg(const char* fmt, const Args&... args)
{
log(level::emerg, fmt, args...);
}
template<typename T>
inline void spdlog::logger::trace(const T& msg)
@@ -175,11 +152,6 @@ inline void spdlog::logger::info(const T& msg)
log(level::info, msg);
}
template<typename T>
inline void spdlog::logger::notice(const T& msg)
{
log(level::notice, msg);
}
template<typename T>
inline void spdlog::logger::warn(const T& msg)
@@ -199,17 +171,6 @@ inline void spdlog::logger::critical(const T& msg)
log(level::critical, msg);
}
template<typename T>
inline void spdlog::logger::alert(const T& msg)
{
log(level::alert, msg);
}
template<typename T>
inline void spdlog::logger::emerg(const T& msg)
{
log(level::emerg, msg);
}