17 #include <android/log.h> 23 #if !defined(SPDLOG_ANDROID_RETRIES) 24 #define SPDLOG_ANDROID_RETRIES 2 33 template<
typename Mutex>
56 formatted.push_back(
'\0');
57 const char *msg_output = formatted.data();
60 int ret = __android_log_write(priority,
tag_.c_str(), msg_output);
65 ret = __android_log_write(priority,
tag_.c_str(), msg_output);
71 throw spdlog_ex(
"__android_log_write() failed", ret);
83 return ANDROID_LOG_VERBOSE;
85 return ANDROID_LOG_DEBUG;
87 return ANDROID_LOG_INFO;
89 return ANDROID_LOG_WARN;
91 return ANDROID_LOG_ERROR;
93 return ANDROID_LOG_FATAL;
95 return ANDROID_LOG_DEFAULT;
109 template<
typename Factory = default_factory>
112 return Factory::template create<sinks::android_sink_mt>(logger_name,
tag);
115 template<
typename Factory = default_factory>
118 return Factory::template create<sinks::android_sink_st>(logger_name,
tag);
std::shared_ptr< logger > android_logger_st(const std::string &logger_name, const std::string &tag="spdlog")
void msg(const char *fmt,...)
void sink_it_(const details::log_msg &msg) override
std::unique_ptr< spdlog::formatter > formatter_
std::shared_ptr< logger > android_logger_mt(const std::string &logger_name, const std::string &tag="spdlog")
#define SPDLOG_ANDROID_RETRIES
android_sink(std::string tag="spdlog", bool use_raw_msg=false)
void append_string_view(spdlog::string_view_t view, fmt::basic_memory_buffer< char, Buffer_Size > &dest)
level::level_enum level() const
static android_LogPriority convert_to_android_(spdlog::level::level_enum level)
const string_view_t payload
void sleep_for_millis(int milliseconds) SPDLOG_NOEXCEPT