FD.io VPP  v21.01.1
Vector Packet Processing
log.c File Reference
+ Include dependency graph for log.c:

Go to the source code of this file.

Functions

 VLIB_REGISTER_LOG_CLASS (log_log, static)
 
int last_log_entry ()
 
static vlib_log_class_data_tget_class_data (vlib_log_class_t ci)
 
static vlib_log_subclass_data_tget_subclass_data (vlib_log_class_t ci)
 
u8format_vlib_log_class (u8 *s, va_list *args)
 
u8format_indent (u8 *s, va_list *args)
 
static int log_level_is_enabled (vlib_log_level_t level, vlib_log_level_t configured)
 
void vlib_log (vlib_log_level_t level, vlib_log_class_t class, char *fmt,...)
 
static vlib_log_class_t vlib_log_register_class_internal (char *class, char *subclass, u32 limit)
 
vlib_log_class_t vlib_log_register_class (char *class, char *subclass)
 
vlib_log_class_t vlib_log_register_class_rate_limit (char *class, char *subclass, u32 limit)
 
u8format_vlib_log_level (u8 *s, va_list *args)
 
static clib_error_tvlib_log_init (vlib_main_t *vm)
 
static clib_error_tshow_log (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tshow_log_config (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tclear_log (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static uword unformat_vlib_log_level (unformat_input_t *input, va_list *args)
 
static uword unformat_vlib_log_class (unformat_input_t *input, va_list *args)
 
static clib_error_tset_log_class (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tset_log_unth_time (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tset_log_size (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static uword unformat_vlib_log_subclass (unformat_input_t *input, va_list *args)
 
static clib_error_ttest_log_class_subclass (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tlog_config_class (vlib_main_t *vm, char *name, unformat_input_t *input)
 
static clib_error_tlog_config (vlib_main_t *vm, unformat_input_t *input)
 

Variables

vlib_log_main_t log_main
 
static const int colors []
 
static const int log_level_to_syslog_priority []
 
static vlib_cli_command_t cli_show_log
 (constructor) VLIB_CLI_COMMAND (cli_show_log) More...
 
static vlib_cli_command_t cli_show_log_config
 (constructor) VLIB_CLI_COMMAND (cli_show_log_config) More...
 
static vlib_cli_command_t cli_clear_log
 (constructor) VLIB_CLI_COMMAND (cli_clear_log) More...
 
static vlib_cli_command_t cli_set_log
 (constructor) VLIB_CLI_COMMAND (cli_set_log) More...
 
static vlib_cli_command_t cli_set_log_params
 (constructor) VLIB_CLI_COMMAND (cli_set_log_params) More...
 
static vlib_cli_command_t cli_set_log_size
 (constructor) VLIB_CLI_COMMAND (cli_set_log_size) More...
 
static vlib_cli_command_t cli_test_log
 (constructor) VLIB_CLI_COMMAND (cli_test_log) More...
 

Function Documentation

◆ clear_log()

static clib_error_t* clear_log ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 485 of file log.c.

+ Here is the call graph for this function:

◆ format_indent()

u8* format_indent ( u8 s,
va_list *  args 
)

Definition at line 102 of file log.c.

+ Here is the caller graph for this function:

◆ format_vlib_log_class()

u8* format_vlib_log_class ( u8 s,
va_list *  args 
)

Definition at line 89 of file log.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ format_vlib_log_level()

u8* format_vlib_log_level ( u8 s,
va_list *  args 
)

Definition at line 352 of file log.c.

+ Here is the caller graph for this function:

◆ get_class_data()

static vlib_log_class_data_t* get_class_data ( vlib_log_class_t  ci)
static

Definition at line 75 of file log.c.

+ Here is the caller graph for this function:

◆ get_subclass_data()

static vlib_log_subclass_data_t* get_subclass_data ( vlib_log_class_t  ci)
static

Definition at line 82 of file log.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ last_log_entry()

int last_log_entry ( )

Definition at line 62 of file log.c.

+ Here is the caller graph for this function:

◆ log_config()

static clib_error_t* log_config ( vlib_main_t vm,
unformat_input_t input 
)
static

Definition at line 838 of file log.c.

+ Here is the call graph for this function:

◆ log_config_class()

static clib_error_t* log_config_class ( vlib_main_t vm,
char *  name,
unformat_input_t input 
)
static

Definition at line 799 of file log.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ log_level_is_enabled()

static int log_level_is_enabled ( vlib_log_level_t  level,
vlib_log_level_t  configured 
)
static

Definition at line 121 of file log.c.

+ Here is the caller graph for this function:

◆ set_log_class()

static clib_error_t* set_log_class ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 565 of file log.c.

+ Here is the call graph for this function:

◆ set_log_size()

static clib_error_t* set_log_size ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 684 of file log.c.

+ Here is the call graph for this function:

◆ set_log_unth_time()

static clib_error_t* set_log_unth_time ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 651 of file log.c.

+ Here is the call graph for this function:

◆ show_log()

static clib_error_t* show_log ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 402 of file log.c.

+ Here is the call graph for this function:

◆ show_log_config()

static clib_error_t* show_log_config ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 437 of file log.c.

+ Here is the call graph for this function:

◆ test_log_class_subclass()

static clib_error_t* test_log_class_subclass ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 745 of file log.c.

+ Here is the call graph for this function:

◆ unformat_vlib_log_class()

static uword unformat_vlib_log_class ( unformat_input_t input,
va_list *  args 
)
static

Definition at line 541 of file log.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unformat_vlib_log_level()

static uword unformat_vlib_log_level ( unformat_input_t input,
va_list *  args 
)
static

Definition at line 516 of file log.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unformat_vlib_log_subclass()

static uword unformat_vlib_log_subclass ( unformat_input_t input,
va_list *  args 
)
static

Definition at line 720 of file log.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_log()

void vlib_log ( vlib_log_level_t  level,
vlib_log_class_t  class,
char *  fmt,
  ... 
)

Definition at line 131 of file log.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_log_init()

static clib_error_t* vlib_log_init ( vlib_main_t vm)
static

Definition at line 369 of file log.c.

+ Here is the call graph for this function:

◆ vlib_log_register_class()

vlib_log_class_t vlib_log_register_class ( char *  class,
char *  subclass 
)

Definition at line 338 of file log.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_log_register_class_internal()

static vlib_log_class_t vlib_log_register_class_internal ( char *  class,
char *  subclass,
u32  limit 
)
static

Definition at line 266 of file log.c.

+ Here is the caller graph for this function:

◆ vlib_log_register_class_rate_limit()

vlib_log_class_t vlib_log_register_class_rate_limit ( char *  class,
char *  subclass,
u32  limit 
)

Definition at line 345 of file log.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ VLIB_REGISTER_LOG_CLASS()

VLIB_REGISTER_LOG_CLASS ( log_log  ,
static   
)

Variable Documentation

◆ cli_clear_log

vlib_cli_command_t cli_clear_log
static
Initial value:
= {
.path = "clear logging",
.short_help = "clear logging",
.function = clear_log,
}
static clib_error_t * clear_log(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: log.c:485

(constructor) VLIB_CLI_COMMAND (cli_clear_log)

Definition at line 508 of file log.c.

◆ cli_set_log

vlib_cli_command_t cli_set_log
static
Initial value:
= {
.path = "set logging class",
.short_help = "set logging class <class> [rate-limit <int>] "
"[level <level>] [syslog-level <level>]",
.function = set_log_class,
}
static clib_error_t * set_log_class(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: log.c:565

(constructor) VLIB_CLI_COMMAND (cli_set_log)

Definition at line 642 of file log.c.

◆ cli_set_log_params

vlib_cli_command_t cli_set_log_params
static
Initial value:
= {
.path = "set logging unthrottle-time",
.short_help = "set logging unthrottle-time <int>",
.function = set_log_unth_time,
}
static clib_error_t * set_log_unth_time(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: log.c:651

(constructor) VLIB_CLI_COMMAND (cli_set_log_params)

Definition at line 676 of file log.c.

◆ cli_set_log_size

vlib_cli_command_t cli_set_log_size
static
Initial value:
= {
.path = "set logging size",
.short_help = "set logging size <int>",
.function = set_log_size,
}
static clib_error_t * set_log_size(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: log.c:684

(constructor) VLIB_CLI_COMMAND (cli_set_log_size)

Definition at line 712 of file log.c.

◆ cli_show_log

vlib_cli_command_t cli_show_log
static
Initial value:
= {
.path = "show logging",
.short_help = "show logging",
.function = show_log,
}
static clib_error_t * show_log(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: log.c:402

(constructor) VLIB_CLI_COMMAND (cli_show_log)

Definition at line 429 of file log.c.

◆ cli_show_log_config

vlib_cli_command_t cli_show_log_config
static
Initial value:
= {
.path = "show logging configuration",
.short_help = "show logging configuration",
.function = show_log_config,
}
static clib_error_t * show_log_config(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: log.c:437

(constructor) VLIB_CLI_COMMAND (cli_show_log_config)

Definition at line 477 of file log.c.

◆ cli_test_log

vlib_cli_command_t cli_test_log
static
Initial value:
= {
.path = "test log",
.short_help = "test log <level> <class> <subclass> <message>",
}
static clib_error_t * test_log_class_subclass(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: log.c:745

(constructor) VLIB_CLI_COMMAND (cli_test_log)

Definition at line 791 of file log.c.

◆ colors

const int colors[]
static
Initial value:
= {
[VLIB_LOG_LEVEL_EMERG] = 1,
[VLIB_LOG_LEVEL_ALERT] = 1,
[VLIB_LOG_LEVEL_CRIT] = 1,
[VLIB_LOG_LEVEL_ERR] = 1,
[VLIB_LOG_LEVEL_WARNING] = 3,
[VLIB_LOG_LEVEL_NOTICE] = 2,
[VLIB_LOG_LEVEL_INFO] = 4,
[VLIB_LOG_LEVEL_DEBUG] = 6,
}

Definition at line 38 of file log.c.

◆ log_level_to_syslog_priority

const int log_level_to_syslog_priority[]
static
Initial value:
= {
[VLIB_LOG_LEVEL_EMERG] = LOG_EMERG,
[VLIB_LOG_LEVEL_ALERT] = LOG_ALERT,
[VLIB_LOG_LEVEL_CRIT] = LOG_CRIT,
[VLIB_LOG_LEVEL_ERR] = LOG_ERR,
[VLIB_LOG_LEVEL_WARNING] = LOG_WARNING,
[VLIB_LOG_LEVEL_NOTICE] = LOG_NOTICE,
[VLIB_LOG_LEVEL_INFO] = LOG_INFO,
[VLIB_LOG_LEVEL_DEBUG] = LOG_DEBUG,
[VLIB_LOG_LEVEL_DISABLED] = LOG_DEBUG,
}

Definition at line 49 of file log.c.

◆ log_main

vlib_log_main_t log_main
Initial value:
= {
.default_log_level = VLIB_LOG_LEVEL_NOTICE,
.default_syslog_log_level = VLIB_LOG_LEVEL_WARNING,
.unthrottle_time = 3,
.size = 512,
.add_to_elog = 1,
.default_rate_limit = 50,
}

Definition at line 23 of file log.c.