HomeWaterLeaksDetection
Logger.h
Go to the documentation of this file.
1 #ifndef LOGGER_H
2 #define LOGGER_H
3 
4 #include "Arduino.h"
5 #include "vector"
6 #include "DateTime.h"
7 #include "TimePeriod.h"
8 #include "ILoggable.h"
9 #include "IControllable.h"
10 
11 #define LOG_PERIOD SEC_TO_MILLIS(1)
12 
13 //==================Logger class========================
14 
20 class Logger : public IControllable {
21 
22 //====================private data======================
23 private:
24  static Logger* instance;
25  std::vector<ILoggable*> logs;
27 
28 //==================private methods=====================
29 private:
31  Logger(){};
32 
34  Logger(Logger const&) {};
35 
37  Logger& operator=(Logger const&) { return *this; }
38 
39 //==================public methods======================
40 public:
47  static Logger* getInstance();
48 
51  void addEntity(ILoggable* log);
52 
58  void update() override;
59 };
60 
61 #endif
TimePeriod.h
Logger::update
void update() override
Updates the class.
Definition: Logger.cpp:14
Logger::getInstance
static Logger * getInstance()
Returns the instance of the class.
Definition: Logger.cpp:5
Logger::instance
static Logger * instance
the instance of the class
Definition: Logger.h:24
DateTime.h
Logger::operator=
Logger & operator=(Logger const &)
Assignment operator of the class.
Definition: Logger.h:37
Logger::timePeriod
TimePeriod timePeriod
time period for recognizing when the log should be printed out
Definition: Logger.h:26
ILoggable.h
Logger::Logger
Logger(Logger const &)
Copy constructor of the class.
Definition: Logger.h:34
TimePeriod
Definition: TimePeriod.h:14
ILoggable
Definition: ILoggable.h:13
Logger::addEntity
void addEntity(ILoggable *log)
Adds another class to the logging system.
Definition: Logger.cpp:10
LOG_PERIOD
#define LOG_PERIOD
how often the log will be printed out
Definition: Logger.h:11
IControllable.h
IControllable
Definition: IControllable.h:13
Logger::Logger
Logger()
Constructor of the class.
Definition: Logger.h:31
Logger
Definition: Logger.h:20
Logger::logs
std::vector< ILoggable * > logs
collection of classes that are registered in the logging system
Definition: Logger.h:25