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()
//syslog example (linux/osx/freebsd)
void syslog_example()
{
#if defined (__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
#ifdef SPDLOG_ENABLE_SYSLOG
std::string ident = "spdlog-example";
auto syslog_logger = spd::syslog_logger("syslog", ident, LOG_PID);
syslog_logger->warn("This is warning that will end up in syslog.");
......
......@@ -37,6 +37,12 @@
#define DEPRECATED
#endif
#ifndef SPDLOG_ENABLE_SYSLOG
#if defined (__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
#define SPDLOG_ENABLE_SYSLOG
#endif
#endif
#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);
}
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
#ifdef SPDLOG_ENABLE_SYSLOG
// 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)
{
......
......@@ -5,10 +5,11 @@
#pragma once
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
#include <spdlog/common.h>
#ifdef SPDLOG_ENABLE_SYSLOG
#include <spdlog/sinks/sink.h>
#include <spdlog/common.h>
#include <spdlog/details/log_msg.h>
#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
//
#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);
#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