mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-25 01:51:38 +08:00
Move syslog support tests to one place.
This commit is contained in:
parent
e556daebc3
commit
2678c37b56
@ -108,7 +108,7 @@ void async_example()
|
|||||||
//syslog example (linux/osx/freebsd)
|
//syslog example (linux/osx/freebsd)
|
||||||
void syslog_example()
|
void syslog_example()
|
||||||
{
|
{
|
||||||
#if defined (__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
#ifdef SPDLOG_ENABLE_SYSLOG
|
||||||
std::string ident = "spdlog-example";
|
std::string ident = "spdlog-example";
|
||||||
auto syslog_logger = spd::syslog_logger("syslog", ident, LOG_PID);
|
auto syslog_logger = spd::syslog_logger("syslog", ident, LOG_PID);
|
||||||
syslog_logger->warn("This is warning that will end up in syslog.");
|
syslog_logger->warn("This is warning that will end up in syslog.");
|
||||||
|
@ -37,6 +37,12 @@
|
|||||||
#define DEPRECATED
|
#define DEPRECATED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef SPDLOG_ENABLE_SYSLOG
|
||||||
|
#if defined (__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||||
|
#define SPDLOG_ENABLE_SYSLOG
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <spdlog/fmt/fmt.h>
|
#include <spdlog/fmt/fmt.h>
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ inline std::shared_ptr<spdlog::logger> spdlog::stderr_logger_st(const std::strin
|
|||||||
return create_console_logger(logger_name, sinks::stderr_sink_st::instance(), color);
|
return create_console_logger(logger_name, sinks::stderr_sink_st::instance(), color);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
#ifdef SPDLOG_ENABLE_SYSLOG
|
||||||
// Create syslog logger
|
// 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 std::string& logger_name, const std::string& syslog_ident, int syslog_option)
|
||||||
{
|
{
|
||||||
|
@ -5,10 +5,11 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
#include <spdlog/common.h>
|
||||||
|
|
||||||
|
#ifdef SPDLOG_ENABLE_SYSLOG
|
||||||
|
|
||||||
#include <spdlog/sinks/sink.h>
|
#include <spdlog/sinks/sink.h>
|
||||||
#include <spdlog/common.h>
|
|
||||||
#include <spdlog/details/log_msg.h>
|
#include <spdlog/details/log_msg.h>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
@ -98,7 +98,7 @@ std::shared_ptr<logger> stderr_logger_st(const std::string& logger_name, bool co
|
|||||||
//
|
//
|
||||||
// Create and register a syslog logger
|
// Create and register a syslog logger
|
||||||
//
|
//
|
||||||
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
#ifdef SPDLOG_ENABLE_SYSLOG
|
||||||
std::shared_ptr<logger> syslog_logger(const std::string& logger_name, const std::string& ident = "", int syslog_option = 0);
|
std::shared_ptr<logger> syslog_logger(const std::string& logger_name, const std::string& ident = "", int syslog_option = 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user