forked from eBay/NuRaft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogger.hxx
109 lines (91 loc) · 2.78 KB
/
logger.hxx
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/************************************************************************
Modifications Copyright 2017-2019 eBay Inc.
Author/Developer(s): Jung-Sang Ahn
Original Copyright:
See URL: https://github.com/datatechnology/cornerstone
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
**************************************************************************/
#ifndef _LOGGER_HXX_
#define _LOGGER_HXX_
#include "pp_util.hxx"
#include <string>
namespace nuraft {
class logger {
__interface_body__(logger);
public:
/**
* (Deprecated)
* Put a debug level log.
*
* @param log_line Contents of the log.
*/
virtual void debug(const std::string& log_line) {}
/**
* (Deprecated)
* Put an info level log.
*
* @param log_line Contents of the log.
*/
virtual void info(const std::string& log_line) {}
/**
* (Deprecated)
* Put a warning level log.
*
* @param log_line Contents of the log.
*/
virtual void warn(const std::string& log_line) {}
/**
* (Deprecated)
* Put an error level log.
*
* @param log_line Contents of the log.
*/
virtual void err(const std::string& log_line) {}
/**
* Set the log level.
* Only logs whose level is equal to or smaller than the log level
* will be recorded.
*
* @param l New log level.
*/
virtual void set_level(int l) {}
/**
* Get the current log level.
*
* @return Current log level.
*/
virtual int get_level() { return 6; }
/**
* Put a log with level, line number, function name,
* and file name.
*
* Log level info:
* Trace: 6
* Debug: 5
* Info: 4
* Warning: 3
* Error: 2
* Fatal: 1
*
* @param level Level of given log.
* @param source_file Name of file where the log is located.
* @param func_name Name of function where the log is located.
* @param line_number Line number of the log.
* @param log_line Contents of the log.
*/
virtual void put_details(int level,
const char* source_file,
const char* func_name,
size_t line_number,
const std::string& log_line) {}
};
}
#endif //_LOGGER_HXX_