From 72a6fd65da618036edfc3be4ec3d74c0a1d8a04c Mon Sep 17 00:00:00 2001 From: Hugh Wang Date: Wed, 14 Sep 2016 17:08:42 +0800 Subject: [PATCH] Support direct creation of android logger. --- include/spdlog/details/spdlog_impl.h | 8 ++++++++ include/spdlog/spdlog.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/include/spdlog/details/spdlog_impl.h b/include/spdlog/details/spdlog_impl.h index b6c95825..16c1a901 100644 --- a/include/spdlog/details/spdlog_impl.h +++ b/include/spdlog/details/spdlog_impl.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -104,6 +105,13 @@ inline std::shared_ptr spdlog::syslog_logger(const std::string& } #endif +#if defined(__ANDROID__) +inline std::shared_ptr spdlog::android_logger(const std::string& logger_name, const std::string& tag) +{ + return create(logger_name, tag); +} +#endif + // Create and register a logger a single sink inline std::shared_ptr spdlog::create(const std::string& logger_name, const spdlog::sink_ptr& sink) { diff --git a/include/spdlog/spdlog.h b/include/spdlog/spdlog.h index dcb9f59e..35067629 100644 --- a/include/spdlog/spdlog.h +++ b/include/spdlog/spdlog.h @@ -101,6 +101,9 @@ std::shared_ptr stderr_logger_st(const std::string& logger_name, bool co std::shared_ptr syslog_logger(const std::string& logger_name, const std::string& ident = "", int syslog_option = 0); #endif +#if defined(__ANDROID__) +std::shared_ptr android_logger(const std::string& logger_name, const std::string& tag = "spdlog"); +#endif // Create and register a logger a single sink std::shared_ptr create(const std::string& logger_name, const sink_ptr& sink);