This commit is contained in:
gabime
2016-09-15 00:38:21 +03:00
parent 6312748cc7
commit 5653e5c9d7
10 changed files with 3257 additions and 2535 deletions

View File

@@ -32,10 +32,11 @@ public:
const android_LogPriority priority = convert_to_android(msg.level);
// See system/core/liblog/logger_write.c for explanation of return value
const int ret = __android_log_write(
priority, _tag.c_str(), msg.formatted.c_str()
);
if (ret < 0) {
throw spdlog_ex("__android_log_write() failed", ret);
priority, _tag.c_str(), msg.formatted.c_str()
);
if (ret < 0)
{
throw spdlog_ex("__android_log_write() failed", ret);
}
}

View File

@@ -35,8 +35,10 @@ protected:
void _sink_it(const details::log_msg& msg) override
{
for (auto &sink : _sinks){
if( sink->should_log( msg.level)){
for (auto &sink : _sinks)
{
if( sink->should_log( msg.level))
{
sink->log(msg);
}
}

View File

@@ -30,15 +30,18 @@ private:
};
inline bool sink::should_log(level::level_enum msg_level) const {
inline bool sink::should_log(level::level_enum msg_level) const
{
return msg_level >= _level.load(std::memory_order_relaxed);
}
inline void sink::set_level(level::level_enum log_level) {
inline void sink::set_level(level::level_enum log_level)
{
_level.store(log_level);
}
inline level::level_enum sink::level() const {
inline level::level_enum sink::level() const
{
return static_cast<spdlog::level::level_enum>(_level.load(std::memory_order_relaxed));
}