-
Notifications
You must be signed in to change notification settings - Fork 25
/
logger.h
65 lines (49 loc) · 1.29 KB
/
logger.h
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef reach_INTERFACES_LOGGER_H
#define reach_INTERFACES_LOGGER_H
#include <atomic>
#include <memory>
#include <string>
namespace YAML
{
class Node;
}
#ifdef BUILD_PYTHON
namespace boost
{
namespace python
{
class dict;
} // namespace python
} // namespace boost
#endif
namespace reach
{
class ReachResultSummary;
/** @brief Interface for logging reach study status and progress */
struct Logger
{
using Ptr = std::shared_ptr<Logger>;
using ConstPtr = std::shared_ptr<const Logger>;
virtual ~Logger() = default;
virtual void setMaxProgress(unsigned long max_progress) = 0;
virtual void printProgress(unsigned long progress) const = 0;
virtual void printResults(const ReachResultSummary& results) const = 0;
virtual void print(const std::string& message) const = 0;
};
/** @brief Plugin interface for generating logger interfaces */
struct LoggerFactory
{
using Ptr = std::shared_ptr<LoggerFactory>;
using ConstPtr = std::shared_ptr<const LoggerFactory>;
virtual ~LoggerFactory() = default;
virtual Logger::Ptr create(const YAML::Node& config) const = 0;
static std::string getSection()
{
return LOGGER_SECTION;
}
#ifdef BUILD_PYTHON
Logger::Ptr create(const boost::python::dict& pyyaml_config) const;
#endif
};
} // namespace reach
#endif // reach_INTERFACES_LOGGER_H