mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 09:58:09 +00:00
log: Don't override -v0 with -v2
If we specify log level to none (0) the result is LOG_INFO (2). Acked-by: Andrew Vagin <avagin@parallels.com> Acked-by: Kir Kolyshkin <kir@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
9ff3f30b75
commit
49b427b721
@ -81,7 +81,7 @@ int main(int argc, char *argv[])
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
bool usage_error = true;
|
bool usage_error = true;
|
||||||
int opt, idx;
|
int opt, idx;
|
||||||
int log_level = 0;
|
int log_level = LOG_UNSET;
|
||||||
char *imgs_dir = ".";
|
char *imgs_dir = ".";
|
||||||
char *work_dir = NULL;
|
char *work_dir = NULL;
|
||||||
static const char short_opts[] = "dsRf:F:t:p:hcD:o:n:v::xVr:jlW:L:";
|
static const char short_opts[] = "dsRf:F:t:p:hcD:o:n:v::xVr:jlW:L:";
|
||||||
@ -192,6 +192,8 @@ int main(int argc, char *argv[])
|
|||||||
goto bad_arg;
|
goto bad_arg;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
|
if (log_level == LOG_UNSET)
|
||||||
|
log_level = 0;
|
||||||
if (optarg) {
|
if (optarg) {
|
||||||
if (optarg[0] == 'v')
|
if (optarg[0] == 'v')
|
||||||
/* handle -vvvvv */
|
/* handle -vvvvv */
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#ifndef __CRIU_LOG_H__
|
#ifndef __CRIU_LOG_H__
|
||||||
#define __CRIU_LOG_H__
|
#define __CRIU_LOG_H__
|
||||||
|
|
||||||
|
#define LOG_UNSET (-1)
|
||||||
#define LOG_MSG (0) /* Print message regardless of log level */
|
#define LOG_MSG (0) /* Print message regardless of log level */
|
||||||
#define LOG_ERROR (1) /* Errors only, when we're in trouble */
|
#define LOG_ERROR (1) /* Errors only, when we're in trouble */
|
||||||
#define LOG_WARN (2) /* Warnings, dazen and confused but trying to continue */
|
#define LOG_WARN (2) /* Warnings, dazen and confused but trying to continue */
|
||||||
|
2
log.c
2
log.c
@ -135,7 +135,7 @@ void log_fini(void)
|
|||||||
|
|
||||||
void log_set_loglevel(unsigned int level)
|
void log_set_loglevel(unsigned int level)
|
||||||
{
|
{
|
||||||
if (!level)
|
if (level == LOG_UNSET)
|
||||||
current_loglevel = DEFAULT_LOGLEVEL;
|
current_loglevel = DEFAULT_LOGLEVEL;
|
||||||
else
|
else
|
||||||
current_loglevel = level;
|
current_loglevel = level;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user