Add version info to debug output

- Initialize the log at the start of ipmi_main() to allow for proper
  logging at the start;
- Remove the unused log_level_get() function;
- Update log_level_set() to take verbosity instead of log level
  (default verbosity is 0, which is LOG_NOTICE log level),
  use the function to update log level as `-v` is encountered
  in command line;
- Move IANA PEN list debugging to verbosity 6. The list is too long
  to see it in each debug output of verbosity 5 that is used for
  debugging lan/lanplus packets;
- For verbosity >= 2 (that is `-vv`) add the ipmitool version
  information at the start.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
This commit is contained in:
Alexander Amelkin
2020-07-17 03:29:42 +03:00
committed by Alexander Amelkin
parent 3a1a9cb283
commit 16f937a117
3 changed files with 16 additions and 15 deletions

View File

@ -1631,6 +1631,7 @@ oem_info_init_from_list(oem_valstr_list_t *oemlist, size_t count)
size_t tail_entries = ARRAY_SIZE(ipmi_oem_info_tail) - 1;
static oem_valstr_list_t *item;
bool rc = false;
int oemlist_debug = LOG_DEBUG + 4; /* Require six -v options */
/* Include static entries and the terminator */
count += head_entries + tail_entries + 1;
@ -1653,7 +1654,7 @@ oem_info_init_from_list(oem_valstr_list_t *oemlist, size_t count)
goto out;
}
lprintf(LOG_DEBUG + 3, " Allocating %6zu entries", count);
lprintf(oemlist_debug, " Allocating %6zu entries", count);
/* Add a terminator at the very end */
--count;
@ -1665,7 +1666,7 @@ oem_info_init_from_list(oem_valstr_list_t *oemlist, size_t count)
((struct valstr *)ipmi_oem_info)[count] =
ipmi_oem_info_tail[tail_entries];
lprintf(LOG_DEBUG + 3, " [%6zu] %8d | %s", count,
lprintf(oemlist_debug, " [%6zu] %8d | %s", count,
ipmi_oem_info[count].val, ipmi_oem_info[count].str);
}
@ -1675,7 +1676,7 @@ oem_info_init_from_list(oem_valstr_list_t *oemlist, size_t count)
((struct valstr *)ipmi_oem_info)[count] =
item->valstr;
lprintf(LOG_DEBUG + 3, " [%6zu] %8d | %s", count,
lprintf(oemlist_debug, " [%6zu] %8d | %s", count,
ipmi_oem_info[count].val, ipmi_oem_info[count].str);
item = item->next;
@ -1686,7 +1687,7 @@ oem_info_init_from_list(oem_valstr_list_t *oemlist, size_t count)
while (count < SIZE_MAX && head_entries--) {
((struct valstr *)ipmi_oem_info)[count] =
ipmi_oem_info_head[head_entries];
lprintf(LOG_DEBUG + 3, " [%6zu] %8d | %s", count,
lprintf(oemlist_debug, " [%6zu] %8d | %s", count,
ipmi_oem_info[count].val, ipmi_oem_info[count].str);
--count;
}