|
|
|
@ -37,62 +37,62 @@ inline void spdlog::register_logger(std::shared_ptr<logger> logger)
|
|
|
|
|
return details::registry::instance().register_logger(logger);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::get(const std::string& name)
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::get(const SPDLOG_NAME_TYPE_REF name)
|
|
|
|
|
{
|
|
|
|
|
return details::registry::instance().get(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void spdlog::drop(const std::string &name)
|
|
|
|
|
inline void spdlog::drop(const SPDLOG_NAME_TYPE_REF name)
|
|
|
|
|
{
|
|
|
|
|
details::registry::instance().drop(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create multi/single threaded rotating file logger
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::rotating_logger_mt(const std::string& logger_name, const std::string& filename, size_t max_file_size, size_t max_files, bool force_flush)
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::rotating_logger_mt(const SPDLOG_NAME_TYPE_REF logger_name, const std::string& filename, size_t max_file_size, size_t max_files, bool force_flush)
|
|
|
|
|
{
|
|
|
|
|
return create<spdlog::sinks::rotating_file_sink_mt>(logger_name, filename, "txt", max_file_size, max_files, force_flush);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::rotating_logger_st(const std::string& logger_name, const std::string& filename, size_t max_file_size, size_t max_files, bool force_flush)
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::rotating_logger_st(const SPDLOG_NAME_TYPE_REF logger_name, const std::string& filename, size_t max_file_size, size_t max_files, bool force_flush)
|
|
|
|
|
{
|
|
|
|
|
return create<spdlog::sinks::rotating_file_sink_st>(logger_name, filename, "txt", max_file_size, max_files, force_flush);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create file logger which creates new file at midnight):
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::daily_logger_mt(const std::string& logger_name, const std::string& filename, int hour, int minute, bool force_flush)
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::daily_logger_mt(const SPDLOG_NAME_TYPE_REF logger_name, const std::string& filename, int hour, int minute, bool force_flush)
|
|
|
|
|
{
|
|
|
|
|
return create<spdlog::sinks::daily_file_sink_mt>(logger_name, filename, "txt", hour, minute, force_flush);
|
|
|
|
|
}
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::daily_logger_st(const std::string& logger_name, const std::string& filename, int hour, int minute, bool force_flush)
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::daily_logger_st(const SPDLOG_NAME_TYPE_REF logger_name, const std::string& filename, int hour, int minute, bool force_flush)
|
|
|
|
|
{
|
|
|
|
|
return create<spdlog::sinks::daily_file_sink_st>(logger_name, filename, "txt", hour, minute, force_flush);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Create stdout/stderr loggers
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::stdout_logger_mt(const std::string& logger_name)
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::stdout_logger_mt(const SPDLOG_NAME_TYPE_REF logger_name)
|
|
|
|
|
{
|
|
|
|
|
return details::registry::instance().create(logger_name, spdlog::sinks::stdout_sink_mt::instance());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::stdout_logger_st(const std::string& logger_name)
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::stdout_logger_st(const SPDLOG_NAME_TYPE_REF logger_name)
|
|
|
|
|
{
|
|
|
|
|
return details::registry::instance().create(logger_name, spdlog::sinks::stdout_sink_st::instance());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::stderr_logger_mt(const std::string& logger_name)
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::stderr_logger_mt(const SPDLOG_NAME_TYPE_REF logger_name)
|
|
|
|
|
{
|
|
|
|
|
return details::registry::instance().create(logger_name, spdlog::sinks::stderr_sink_mt::instance());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::stderr_logger_st(const std::string& logger_name)
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::stderr_logger_st(const SPDLOG_NAME_TYPE_REF logger_name)
|
|
|
|
|
{
|
|
|
|
|
return details::registry::instance().create(logger_name, spdlog::sinks::stderr_sink_st::instance());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef __linux__
|
|
|
|
|
// Create syslog logger
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::syslog_logger(const std::string& logger_name, const std::string& syslog_ident, int syslog_option)
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::syslog_logger(const SPDLOG_NAME_TYPE_REF logger_name, const std::string& syslog_ident, int syslog_option)
|
|
|
|
|
{
|
|
|
|
|
return create<spdlog::sinks::syslog_sink>(logger_name, syslog_ident, syslog_option);
|
|
|
|
|
}
|
|
|
|
@ -101,14 +101,14 @@ inline std::shared_ptr<spdlog::logger> spdlog::syslog_logger(const std::string&
|
|
|
|
|
|
|
|
|
|
//Create logger with multiple sinks
|
|
|
|
|
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::create(const std::string& logger_name, spdlog::sinks_init_list sinks)
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::create(const SPDLOG_NAME_TYPE_REF logger_name, spdlog::sinks_init_list sinks)
|
|
|
|
|
{
|
|
|
|
|
return details::registry::instance().create(logger_name, sinks);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template <typename Sink, typename... Args>
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::create(const std::string& logger_name, const Args&... args)
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::create(const SPDLOG_NAME_TYPE_REF logger_name, const Args&... args)
|
|
|
|
|
{
|
|
|
|
|
sink_ptr sink = std::make_shared<Sink>(args...);
|
|
|
|
|
return details::registry::instance().create(logger_name, { sink });
|
|
|
|
@ -116,7 +116,7 @@ inline std::shared_ptr<spdlog::logger> spdlog::create(const std::string& logger_
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<class It>
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::create(const std::string& logger_name, const It& sinks_begin, const It& sinks_end)
|
|
|
|
|
inline std::shared_ptr<spdlog::logger> spdlog::create(const SPDLOG_NAME_TYPE_REF logger_name, const It& sinks_begin, const It& sinks_end)
|
|
|
|
|
{
|
|
|
|
|
return details::registry::instance().create(logger_name, sinks_begin, sinks_end);
|
|
|
|
|
}
|
|
|
|
|