mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
criu: change the way -v works
For most of the CLI tools I see, adding -v option increases their verbosity. Currently, this is not the case for criu. Default verbosity is set it 2, and using -v actually decreases the verbosity level to 1, so to increase verbosity you need to use -vvv (or -v3). To me, this behavior is quite counterintuitive. This patch changes the way -v works (but retains -vNUM as it was). Now, using -v increases verbosity by +1 from the default value (and e.g. -vvv increases it by +3). Surely, this changes user experience: for example someone who was using -v (rather than -v1 or -v0) to silent warnings, will now have verbosity increased. IMHO this is for the better. Signed-off-by: Kir Kolyshkin <kir@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
c58d33944e
commit
c4247302f7
3 changed files with 25 additions and 23 deletions
|
|
@ -28,19 +28,25 @@ Common options
|
|||
~~~~~~~~~~~~~~
|
||||
Common options are applicable to any 'command'.
|
||||
|
||||
*-v*['num'|*v*...]::
|
||||
Set logging level to 'num'. The higher the level, the more output
|
||||
is produced. Either numeric values or multiple *v* can be used.
|
||||
*-v*[*v*...]::
|
||||
Increase verbosity up from the default level. Multiple *v* can be used,
|
||||
each increasing verbosity by one level.
|
||||
|
||||
*-v*'num'::
|
||||
Set verbosity level to 'num'. The higher the level, the more output
|
||||
is produced.
|
||||
+
|
||||
The following levels are available:
|
||||
* *-v1*, *-v*
|
||||
only messages and errors;
|
||||
* *-v2*, *-vv*
|
||||
also warnings (default level);
|
||||
* *-v3*, *-vvv*
|
||||
also information messages and timestamps;
|
||||
* *-v4*, *-vvvv*
|
||||
lots of debug.
|
||||
* *-v0*
|
||||
no output;
|
||||
* *-v1*
|
||||
only errors;
|
||||
* *-v2*
|
||||
above plus warnings (this is the default level);
|
||||
* *-v3*
|
||||
above plus information messages and timestamps;
|
||||
* *-v4*
|
||||
above plus lots of debug.
|
||||
|
||||
*--pidfile* 'file'::
|
||||
Write root task, service or page-server pid into a 'file'.
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ int main(int argc, char *argv[], char *envp[])
|
|||
bool has_exec_cmd = false;
|
||||
bool has_sub_command;
|
||||
int opt, idx;
|
||||
int log_level = LOG_UNSET;
|
||||
int log_level = DEFAULT_LOGLEVEL;
|
||||
char *imgs_dir = ".";
|
||||
static const char short_opts[] = "dSsRf:F:t:p:hcD:o:v::x::Vr:jJ:lW:L:M:";
|
||||
static struct option long_opts[] = {
|
||||
|
|
@ -381,8 +381,6 @@ int main(int argc, char *argv[], char *envp[])
|
|||
goto bad_arg;
|
||||
break;
|
||||
case 'v':
|
||||
if (log_level == LOG_UNSET)
|
||||
log_level = 0;
|
||||
if (optarg) {
|
||||
if (optarg[0] == 'v')
|
||||
/* handle -vvvvv */
|
||||
|
|
@ -928,11 +926,12 @@ usage:
|
|||
"* Logging:\n"
|
||||
" -o|--log-file FILE log file name\n"
|
||||
" --log-pid enable per-process logging to separate FILE.pid files\n"
|
||||
" -v[NUM] set logging level (higher level means more output):\n"
|
||||
" -v1|-v - only errors and messages\n"
|
||||
" -v2|-vv - also warnings (default level)\n"
|
||||
" -v3|-vvv - also information messages and timestamps\n"
|
||||
" -v4|-vvvv - lots of debug\n"
|
||||
" -v[v...] increase verbosity (can use multiple v)\n"
|
||||
" -vNUM set verbosity to NUM (higher level means more output):\n"
|
||||
" -v1 - only errors and messages\n"
|
||||
" -v2 - also warnings (default level)\n"
|
||||
" -v3 - also information messages and timestamps\n"
|
||||
" -v4 - lots of debug\n"
|
||||
" --display-stats print out dump/restore stats\n"
|
||||
"\n"
|
||||
"* Memory dumping options:\n"
|
||||
|
|
|
|||
|
|
@ -201,10 +201,7 @@ void log_fini(void)
|
|||
|
||||
void log_set_loglevel(unsigned int level)
|
||||
{
|
||||
if (level == LOG_UNSET)
|
||||
current_loglevel = DEFAULT_LOGLEVEL;
|
||||
else
|
||||
current_loglevel = level;
|
||||
current_loglevel = level;
|
||||
}
|
||||
|
||||
unsigned int log_get_loglevel(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue