diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-01-24 18:27:05 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-01-24 18:27:05 +0100 |
commit | 561aae3b03cec35e14e529f0006155ee3db07df5 (patch) | |
tree | beb5cbb02fcb33aa762afc91cf8d1e29c216c651 /src/Log.h | |
parent | 8028302eb5b5f6ea77e57887f3b31bd9abafeb27 (diff) | |
download | dabmux-561aae3b03cec35e14e529f0006155ee3db07df5.tar.gz dabmux-561aae3b03cec35e14e529f0006155ee3db07df5.tar.bz2 dabmux-561aae3b03cec35e14e529f0006155ee3db07df5.zip |
Initialise syslog earlier, don't leak the syslog backend
Diffstat (limited to 'src/Log.h')
-rw-r--r-- | src/Log.h | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -3,7 +3,10 @@ Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C), 2014, Matthias P. Braendli, matthias.braendli@mpb.li + Copyright (C) 2017 + Matthias P. Braendli, matthias.braendli@mpb.li + + http://www.opendigitalradio.org */ /* This file is part of ODR-DabMux. @@ -22,8 +25,7 @@ along with ODR-DabMux. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef _LOG_H -#define _LOG_H +#pragma once #ifdef HAVE_CONFIG_H # include "config.h" @@ -40,6 +42,7 @@ #include <string> #include <map> #include <mutex> +#include <memory> #define SYSLOG_IDENT "ODR-DabMux" #define SYSLOG_FACILITY LOG_LOCAL0 @@ -131,9 +134,7 @@ class LogLine; class Logger { public: - Logger() {} - - void register_backend(LogBackend* backend); + void register_backend(std::shared_ptr<LogBackend> backend); /* Log the message to all backends */ void log(log_level_t level, const char* fmt, ...); @@ -145,7 +146,7 @@ class Logger { LogLine level(log_level_t level); private: - std::list<LogBackend*> backends; + std::list<std::shared_ptr<LogBackend> > backends; std::mutex m_cerr_mutex; }; @@ -186,5 +187,3 @@ class LogLine { }; -#endif - |