virtiofsd: print log only when priority is high enough

Introduce "-o log_level=" command line option to specify current log
level (priority), valid values are "debug info warn err", e.g.

    ./virtiofsd -o log_level=debug ...

So only log priority higher than "debug" will be printed to
stderr/syslog. And the default level is info.

The "-o debug"/"-d" options are kept, and imply debug log level.

Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>
dgilbert: Reworked for libfuse's log_func
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
with fix by:
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
Eryu Guan
2019-08-09 16:25:35 +08:00
committed by Dr. David Alan Gilbert
parent f185621d41
commit d240314a1a
4 changed files with 87 additions and 115 deletions

View File

@@ -1796,6 +1796,7 @@ struct fuse_cmdline_opts {
int show_help;
int print_capabilities;
int syslog;
int log_level;
unsigned int max_idle_threads;
};