FD.io VPP  v18.07-rc0-415-g6c78436
Vector Packet Processing
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 
22 
23 #define foreach_vlib_log_level \
24  _(0, EMERG, emerg) \
25  _(1, ALERT, alert) \
26  _(2, CRIT, crit) \
27  _(3, ERR, err) \
28  _(4, WARNING, warn) \
29  _(5, NOTICE, notice) \
30  _(6, INFO, info) \
31  _(7, DEBUG, debug) \
32  _(8, DISABLED, disabled)
33 
34 typedef enum
35 {
36 #define _(n,uc,lc) VLIB_LOG_LEVEL_##uc = n,
38 #undef _
40 
41 
42 vlib_log_class_t vlib_log_register_class (char *vlass, char *subclass);
44 void vlib_log (vlib_log_level_t level, vlib_log_class_t class, char *fmt,
45  ...);
46 
47 #define vlib_log_emerg(...) vlib_log(VLIB_LOG_LEVEL_EMERG, __VA_ARGS__)
48 #define vlib_log_alert(...) vlib_log(VLIB_LOG_LEVEL_ALERT, __VA_ARGS__)
49 #define vlib_log_crit(...) vlib_log(VLIB_LOG_LEVEL_CRIT, __VA_ARGS__)
50 #define vlib_log_err(...) vlib_log(VLIB_LOG_LEVEL_ERR, __VA_ARGS__)
51 #define vlib_log_warn(...) vlib_log(VLIB_LOG_LEVEL_WARNING, __VA_ARGS__)
52 #define vlib_log_notice(...) vlib_log(VLIB_LOG_LEVEL_NOTICE, __VA_ARGS__)
53 #define vlib_log_info(...) vlib_log(VLIB_LOG_LEVEL_INFO, __VA_ARGS__)
54 #define vlib_log_debug(...) vlib_log(VLIB_LOG_LEVEL_DEBUG, __VA_ARGS__)
55 
56 #endif /* included_vlib_log_h */
57 
58 /*
59  * fd.io coding-style-patch-verification: ON
60  *
61  * Local Variables:
62  * eval: (c-set-style "gnu")
63  * End:
64  */
u32 vlib_log_class_t
Definition: log.h:21
vlib_log_class_t vlib_log_register_class(char *vlass, char *subclass)
Definition: log.c:221
unsigned int u32
Definition: types.h:88
#define foreach_vlib_log_level
Definition: log.h:23
void vlib_log(vlib_log_level_t level, vlib_log_class_t class, char *fmt,...)
Definition: log.c:133
vlib_log_level_t
Definition: log.h:34
u32 vlib_log_get_indent()
Definition: log.c:269