Commit 2678c37b authored by Nazım Can Bedir's avatar Nazım Can Bedir

Move syslog support tests to one place.

parent e556daeb
...@@ -108,7 +108,7 @@ void async_example() ...@@ -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 @@ ...@@ -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 ...@@ -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 @@ ...@@ -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 ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment