-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogger.h
73 lines (55 loc) · 1.24 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
66
67
68
69
70
71
72
73
#pragma once
#include <iostream>
#include <chrono>
#include <iomanip>
#include <sstream>
#include <string>
#include <ctime>
#include <memory>
#include "common_defines.h"
#include "os_wrappers.h"
#include "job_open62541_node.h"
#include "data_open62541.h"
/* Classic log */
#define cLOG(level, message) Logger::get_instance().log(level, message)
/* Job log */
#define jLOG(level, message, jsptr) Logger::get_instance().log(level, message, jsptr)
/* Data log */
#define dLOG(level, message, jsptr) Logger::get_instance().log(level, message, jsptr)
enum class Level
{
LINFO,
LWARNING,
LERROR,
LJOB,
LDATA
};
/* Forward declaration */
class Job;
/**
* Class Logger
* ^^^^^^^^^^^^
*/
class Logger
{
public:
Logger() = default;
virtual
~Logger() = default;
Logger(const Logger&) = delete;
Logger&
operator=(const Logger&) = delete;
Logger(Logger&&) = delete;
Logger&
operator=(Logger&&) = delete;
/* Return static logger instance */
static Logger&
get_instance(void);
/* Basic log level parser */
void
log(Level level, const std::string&, opcuac::jobsptr = nullptr);
/* Time function */
std::string
actual_time(void);
};
/* Eof */