Commit 4769586b authored by Micha Mueller's avatar Micha Mueller
Browse files

Add logger as member variable to Sensor and Configurator base class

parent 76ec9e7d
......@@ -8,11 +8,11 @@
#ifndef SRC_CONFIGURATOR_H_
#define SRC_CONFIGURATOR_H_
#include "Sensor.h"
#include <vector>
#include <string>
class Sensor;
/**
* Abstract base class, which defines the interface for the configurators in the shared dynamic libraries.
*/
......@@ -34,6 +34,7 @@ public:
protected:
std::string _mqttPrefix;
boost::log::sources::severity_logger<boost::log::trivial::severity_level> lg;
};
//typedef for more readable usage of create()- and destroy()-methods, required for dynamic libraries
......
......@@ -12,6 +12,15 @@
#include <boost/asio.hpp>
#include <boost/lockfree/spsc_queue.hpp>
//TODO includes and defines for logging are only here once because Sensor.h is somehow involved everywhere
// but is this the best possiblility?
#include <boost/log/trivial.hpp>
#include <boost/log/sources/severity_logger.hpp>
//abbreviate the shortcut-macro
//to use it only a boost severity-logger named lg is required
#define LOG(sev) BOOST_LOG_SEV(lg, boost::log::trivial::sev)
typedef struct {
uint64_t value;
uint64_t timestamp;
......@@ -58,6 +67,7 @@ protected:
reading_t _latestValue;
boost::asio::deadline_timer* _timer;
boost::lockfree::spsc_queue<reading_t>* _readingQueue;
boost::log::sources::severity_logger<boost::log::trivial::severity_level> lg;
};
#endif /* SENSOR_H_ */
Supports Markdown
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