FD.io VPP
v19.08-27-gf4dcae4
Vector Packet Processing
Main Page
Related Pages
Modules
Namespaces
Data Structures
Source
Files
Symbols
log.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2018 Cisco and/or its affiliates.
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at:
6
*
7
* http://www.apache.org/licenses/LICENSE-2.0
8
*
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
14
*/
15
16
#ifndef included_vlib_log_h
17
#define included_vlib_log_h
18
19
#include <
vppinfra/types.h
>
20
21
#define foreach_vlib_log_level \
22
_(0, EMERG, emerg) \
23
_(1, ALERT, alert) \
24
_(2, CRIT, crit) \
25
_(3, ERR, err) \
26
_(4, WARNING, warn) \
27
_(5, NOTICE, notice) \
28
_(6, INFO, info) \
29
_(7, DEBUG, debug) \
30
_(8, DISABLED, disabled)
31
32
typedef
enum
33
{
34
#define _(n,uc,lc) VLIB_LOG_LEVEL_##uc = n,
35
foreach_vlib_log_level
36
#undef _
37
}
vlib_log_level_t
;
38
39
typedef
struct
40
{
41
vlib_log_level_t
level
;
42
vlib_log_class_t
class
;
43
f64
timestamp
;
44
u8
*
string
;
45
}
vlib_log_entry_t
;
46
47
typedef
struct
48
{
49
u32
index
;
50
u8
*
name
;
51
// level of log messages kept for this subclass
52
vlib_log_level_t
level
;
53
// level of log messages sent to syslog for this subclass
54
vlib_log_level_t
syslog_level
;
55
// flag saying whether this subclass is logged to syslog
56
f64
last_event_timestamp
;
57
int
last_sec_count
;
58
int
is_throttling
;
59
int
rate_limit
;
60
}
vlib_log_subclass_data_t
;
61
62
typedef
struct
63
{
64
u32
index
;
65
u8
*
name
;
66
vlib_log_subclass_data_t
*
subclasses
;
67
}
vlib_log_class_data_t
;
68
69
typedef
struct
70
{
71
vlib_log_entry_t
*
entries
;
72
vlib_log_class_data_t
*
classes
;
73
int
size
, next,
count
;
74
75
/* our own log class */
76
vlib_log_class_t
log_class
;
77
78
int
default_rate_limit
;
79
int
default_log_level
;
80
int
default_syslog_log_level
;
81
int
unthrottle_time
;
82
u32
indent
;
83
84
/* time zero */
85
struct
timeval time_zero_timeval;
86
f64
time_zero
;
87
88
}
vlib_log_main_t
;
89
90
extern
vlib_log_main_t
log_main
;
91
92
vlib_log_class_t
vlib_log_register_class
(
char
*vlass,
char
*subclass);
93
u32
vlib_log_get_indent
();
94
void
vlib_log
(
vlib_log_level_t
level,
vlib_log_class_t
class
,
char
*fmt,
95
...);
96
int
last_log_entry
();
97
u8
*
format_vlib_log_class
(
u8
* s, va_list * args);
98
99
#define vlib_log_emerg(...) vlib_log(VLIB_LOG_LEVEL_EMERG, __VA_ARGS__)
100
#define vlib_log_alert(...) vlib_log(VLIB_LOG_LEVEL_ALERT, __VA_ARGS__)
101
#define vlib_log_crit(...) vlib_log(VLIB_LOG_LEVEL_CRIT, __VA_ARGS__)
102
#define vlib_log_err(...) vlib_log(VLIB_LOG_LEVEL_ERR, __VA_ARGS__)
103
#define vlib_log_warn(...) vlib_log(VLIB_LOG_LEVEL_WARNING, __VA_ARGS__)
104
#define vlib_log_notice(...) vlib_log(VLIB_LOG_LEVEL_NOTICE, __VA_ARGS__)
105
#define vlib_log_info(...) vlib_log(VLIB_LOG_LEVEL_INFO, __VA_ARGS__)
106
#define vlib_log_debug(...) vlib_log(VLIB_LOG_LEVEL_DEBUG, __VA_ARGS__)
107
108
#endif
/* included_vlib_log_h */
109
110
/*
111
* fd.io coding-style-patch-verification: ON
112
*
113
* Local Variables:
114
* eval: (c-set-style "gnu")
115
* End:
116
*/
vlib_log_class_data_t
Definition:
log.h:62
vlib_log_main_t::entries
vlib_log_entry_t * entries
Definition:
log.h:71
vlib_log_subclass_data_t::level
vlib_log_level_t level
Definition:
log.h:52
format_vlib_log_class
u8 * format_vlib_log_class(u8 *s, va_list *args)
Definition:
log.c:73
vlib_log_subclass_data_t::syslog_level
vlib_log_level_t syslog_level
Definition:
log.h:54
vlib_log_class_data_t::name
u8 * name
Definition:
log.h:65
vlib_log_main_t::classes
vlib_log_class_data_t * classes
Definition:
log.h:72
vlib_log_register_class
vlib_log_class_t vlib_log_register_class(char *vlass, char *subclass)
Definition:
log.c:176
vlib_log_entry_t::timestamp
f64 timestamp
Definition:
log.h:43
u8
unsigned char u8
Definition:
types.h:56
f64
double f64
Definition:
types.h:142
vlib_log_main_t::indent
u32 indent
Definition:
log.h:82
vlib_log_class_t
u32 vlib_log_class_t
Definition:
vlib.h:51
u32
unsigned int u32
Definition:
types.h:88
vlib_log_main_t::default_log_level
int default_log_level
Definition:
log.h:79
vlib_log_main_t::log_class
vlib_log_class_t log_class
Definition:
log.h:76
vlib_log_subclass_data_t
Definition:
log.h:47
foreach_vlib_log_level
#define foreach_vlib_log_level
Definition:
log.h:21
vlib_log_main_t::default_syslog_log_level
int default_syslog_log_level
Definition:
log.h:80
vlib_log_main_t::size
int size
Definition:
log.h:73
vlib_log
void vlib_log(vlib_log_level_t level, vlib_log_class_t class, char *fmt,...)
Definition:
log.c:87
vlib_log_subclass_data_t::name
u8 * name
Definition:
log.h:50
vlib_log_class_data_t::subclasses
vlib_log_subclass_data_t * subclasses
Definition:
log.h:66
vlib_log_subclass_data_t::is_throttling
int is_throttling
Definition:
log.h:58
vlib_log_main_t::default_rate_limit
int default_rate_limit
Definition:
log.h:78
vlib_log_entry_t
Definition:
log.h:39
vlib_log_level_t
vlib_log_level_t
Definition:
log.h:32
vlib_log_class_data_t::index
u32 index
Definition:
log.h:64
vlib_log_main_t
Definition:
log.h:69
count
size_t count
Definition:
vapi.c:47
vlib_log_entry_t::level
vlib_log_level_t level
Definition:
log.h:41
vlib_log_main_t::time_zero
f64 time_zero
Definition:
log.h:86
vlib_log_get_indent
u32 vlib_log_get_indent()
Definition:
log.c:226
types.h
log_main
vlib_log_main_t log_main
Definition:
log.c:21
vlib_log_subclass_data_t::index
u32 index
Definition:
log.h:49
vlib_log_subclass_data_t::last_sec_count
int last_sec_count
Definition:
log.h:57
vlib_log_subclass_data_t::last_event_timestamp
f64 last_event_timestamp
Definition:
log.h:56
last_log_entry
int last_log_entry()
Definition:
log.c:30
vlib_log_subclass_data_t::rate_limit
int rate_limit
Definition:
log.h:59
vlib_log_entry_t::string
u8 * string
Definition:
log.h:44
vlib_log_main_t::unthrottle_time
int unthrottle_time
Definition:
log.h:81
src
vlib
log.h
Generated on Wed Sep 18 2019 17:44:06 for FD.io VPP by
1.8.11