Commit a36fdfef authored by Lukáš Hrázký's avatar Lukáš Hrázký Committed by Frediano Ziglio

Move the syslog() helper for errors to a new utils module

The syslog() helper for logging an error is not necessary, leave it out
of the API and move it to a new private utils module.
Signed-off-by: Lukáš Hrázký's avatarLukáš Hrázký <lhrazky@redhat.com>
Acked-by: Frediano Ziglio's avatarFrediano Ziglio <fziglio@redhat.com>
parent 27fa4bce
......@@ -9,7 +9,6 @@
#include <stdexcept>
#include <string>
#include <syslog.h>
namespace spice {
......@@ -21,13 +20,6 @@ public:
Error(const std::string &message) : std::runtime_error(message) {}
};
template<class T>
const T &syslog(const T &error) noexcept
{
::syslog(LOG_ERR, "%s\n", error.what());
return error;
}
}} // namespace spice::streaming_agent
#endif // SPICE_STREAMING_AGENT_ERROR_HPP
......@@ -65,6 +65,7 @@ spice_streaming_agent_SOURCES = \
jpeg.hpp \
stream-port.cpp \
stream-port.hpp \
utils.hpp \
$(NULL)
if HAVE_GST
......
......@@ -14,6 +14,7 @@
#include <memory>
#include <vector>
#include <syslog.h>
#include <unistd.h>
#include <X11/extensions/Xfixes.h>
......
......@@ -9,6 +9,7 @@
#include "cursor-updater.hpp"
#include "frame-log.hpp"
#include "stream-port.hpp"
#include "utils.hpp"
#include <spice-streaming-agent/error.hpp>
#include <spice/stream-device.h>
......@@ -254,7 +255,7 @@ do_capture(StreamPort &stream_port, FrameLog &frame_log)
try {
stream_port.send<FrameMessage>(frame.buffer, frame.buffer_size);
} catch (const WriteError& e) {
syslog(e);
utils::syslog(e);
break;
}
frame_log.log_stat("Sent frame");
......
/* \copyright
* Copyright 2018 Red Hat Inc. All rights reserved.
*/
#ifndef SPICE_STREAMING_AGENT_UTILS_HPP
#define SPICE_STREAMING_AGENT_UTILS_HPP
#include <syslog.h>
namespace spice {
namespace streaming_agent {
namespace utils {
template<class T>
const T &syslog(const T &error) noexcept
{
::syslog(LOG_ERR, "%s\n", error.what());
return error;
}
}}} // namespace spice::streaming_agent::utils
#endif // SPICE_STREAMING_AGENT_UTILS_HPP
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