|
1 | 1 | /// |
2 | 2 | /// \file MonLogger.h |
3 | | -/// \author Barthelemy von Haller |
4 | 3 | /// \author Adam Wegrzynek <[email protected]> |
5 | 4 | /// |
6 | 5 |
|
7 | 6 | #ifndef MONITORING_MONINFOLOGGER_H |
8 | 7 | #define MONITORING_MONINFOLOGGER_H |
9 | 8 |
|
10 | 9 | #include <iostream> |
11 | | -#include <InfoLogger/InfoLogger.hxx> |
12 | 10 |
|
13 | 11 | namespace AliceO2 |
14 | 12 | { |
15 | 13 | /// ALICE O2 Monitoring system |
16 | 14 | namespace Monitoring |
17 | 15 | { |
18 | 16 |
|
19 | | -using namespace AliceO2::InfoLogger; |
20 | | - |
21 | | -/// Singleton class that is used in all Monitoring classes |
22 | | -/// |
23 | | -/// The aim of this class is to avoid every class in the package to define and configure its own instance of InfoLogger. |
24 | | -/// Independent InfoLogger instance can still be created when and if needed. |
25 | | -class MonLogger : public AliceO2::InfoLogger::InfoLogger |
| 17 | +/// Simple Monitoring logging class |
| 18 | +class MonLogger |
26 | 19 | { |
27 | 20 | public: |
| 21 | + template <typename T> |
| 22 | + MonLogger &operator<<(const T &log) { |
| 23 | + mStream << log; |
| 24 | + return *this; |
| 25 | + } |
| 26 | + |
| 27 | + MonLogger &operator<<(std::ostream& (*log) (std::ostream&)) { |
| 28 | + mStream << log; |
| 29 | + return *this; |
| 30 | + } |
28 | 31 | static MonLogger &Get() |
29 | 32 | { |
30 | | - static MonLogger infoLoggerInstance; |
31 | | - return infoLoggerInstance; |
| 33 | + static MonLogger loggerInstance; |
| 34 | + return loggerInstance; |
32 | 35 | } |
33 | | - static auto End() -> decltype(AliceO2::InfoLogger::InfoLogger::endm) |
| 36 | + static auto End() -> decltype("\n") |
34 | 37 | { |
35 | | - return AliceO2::InfoLogger::InfoLogger::endm; |
| 38 | + return "\n"; |
36 | 39 | } |
37 | 40 |
|
38 | 41 | private: |
39 | | - MonLogger() = default; |
| 42 | + std::ostream &mStream; |
| 43 | + MonLogger(std::ostream &oStream = std::cout): mStream(oStream) {}; |
40 | 44 |
|
41 | 45 | /// Delete copy and move constructors |
42 | 46 | MonLogger &operator=(const MonLogger &) = delete; |
43 | 47 | MonLogger(const MonLogger &) = delete; |
44 | 48 | MonLogger(MonLogger &&) = delete; |
45 | | - MonLogger &operator=(InfoLogger&&) = delete; |
| 49 | + MonLogger &operator=(MonLogger&&) = delete; |
46 | 50 |
|
47 | 51 | }; |
48 | 52 |
|
|
0 commit comments