blob: 780cbcc3feb34f71d3ab4de038b4a4972918c6c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#ifndef LOGGERFACTORY_H
#define LOGGERFACTORY_H
#include <factory.h>
#include "lifeCycle.h"
#include "logger.h"
#include <visibility.h>
/// Base class for classes providing a logging facility
class DLL_PUBLIC LogDriverBase {
public:
LogDriverBase();
virtual ~LogDriverBase();
virtual void message(int priority, const char * msg) const = 0;
};
class DLL_PUBLIC LogDriverFactory : public AdHoc::Factory<LogDriverBase> {
public:
virtual int loggerLevel() const = 0;
};
template<typename LoggerType>
class LogDriverFactoryImpl : public LogDriverFactory, public LifeCycle {
public:
LogDriverFactoryImpl();
virtual void onConfigLoad() override;
inline std::shared_ptr<LogDriverBase> create() const override;
int loggerLevel() const override;
const int & level;
protected:
mutable std::shared_ptr<LoggerType> instance;
};
#endif
|