This commit is contained in:
gabime
2015-11-28 16:52:02 +02:00
parent 992a4e6077
commit 0f76db880e
11 changed files with 748 additions and 382 deletions

View File

@@ -58,8 +58,8 @@ protected:
const android_LogPriority priority = convert_to_android(msg.level);
const int expected_size = msg.formatted.size();
const int size = __android_log_write(
priority, _tag.c_str(), msg.formatted.c_str()
);
priority, _tag.c_str(), msg.formatted.c_str()
);
if (size > expected_size)
{
// Will write a little bit more than original message
@@ -75,16 +75,26 @@ private:
{
switch(level)
{
case spdlog::level::trace: return ANDROID_LOG_VERBOSE;
case spdlog::level::debug: return ANDROID_LOG_DEBUG;
case spdlog::level::info: return ANDROID_LOG_INFO;
case spdlog::level::notice: return ANDROID_LOG_INFO;
case spdlog::level::warn: return ANDROID_LOG_WARN;
case spdlog::level::err: return ANDROID_LOG_ERROR;
case spdlog::level::critical: return ANDROID_LOG_FATAL;
case spdlog::level::alert: return ANDROID_LOG_FATAL;
case spdlog::level::emerg: return ANDROID_LOG_FATAL;
default: throw spdlog_ex("Incorrect level value");
case spdlog::level::trace:
return ANDROID_LOG_VERBOSE;
case spdlog::level::debug:
return ANDROID_LOG_DEBUG;
case spdlog::level::info:
return ANDROID_LOG_INFO;
case spdlog::level::notice:
return ANDROID_LOG_INFO;
case spdlog::level::warn:
return ANDROID_LOG_WARN;
case spdlog::level::err:
return ANDROID_LOG_ERROR;
case spdlog::level::critical:
return ANDROID_LOG_FATAL;
case spdlog::level::alert:
return ANDROID_LOG_FATAL;
case spdlog::level::emerg:
return ANDROID_LOG_FATAL;
default:
throw spdlog_ex("Incorrect level value");
}
}

View File

@@ -69,7 +69,7 @@ public:
{
std::lock_guard<Mutex> lock(base_sink<Mutex>::_mutex);
if (sink &&
_sinks.end() == std::find(_sinks.begin(), _sinks.end(), sink))
_sinks.end() == std::find(_sinks.begin(), _sinks.end(), sink))
{
_sinks.push_back(sink);
}

View File

@@ -230,4 +230,4 @@ private:
typedef daily_file_sink<std::mutex> daily_file_sink_mt;
typedef daily_file_sink<details::null_mutex> daily_file_sink_st;
}
}
}