Add a command line option to increase the loglevel.
By default, the universal application will always log error and warning messages, but the loglevel can be increased to also log info and debug messages.
This commit is contained in:
parent
55c16d0d0f
commit
dad451f6f9
@ -704,6 +704,7 @@ main (int argc, char *argv[])
|
||||
{
|
||||
// Default values.
|
||||
dc_family_t backend = DC_FAMILY_NULL;
|
||||
dc_loglevel_t loglevel = DC_LOGLEVEL_WARNING;
|
||||
const char *name = NULL;
|
||||
const char *logfile = "output.log";
|
||||
const char *rawfile = "output.bin";
|
||||
@ -716,7 +717,7 @@ main (int argc, char *argv[])
|
||||
#ifndef _MSC_VER
|
||||
// Parse command-line options.
|
||||
int opt = 0;
|
||||
while ((opt = getopt (argc, argv, "n:b:t:f:l:m:d:c:h")) != -1) {
|
||||
while ((opt = getopt (argc, argv, "n:b:t:f:l:m:d:c:vh")) != -1) {
|
||||
switch (opt) {
|
||||
case 'n':
|
||||
name = optarg;
|
||||
@ -734,6 +735,9 @@ main (int argc, char *argv[])
|
||||
case 'l':
|
||||
logfile = optarg;
|
||||
break;
|
||||
case 'v':
|
||||
loglevel++;
|
||||
break;
|
||||
case 'm':
|
||||
memory = 1;
|
||||
rawfile = optarg;
|
||||
@ -780,7 +784,7 @@ main (int argc, char *argv[])
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
dc_context_set_loglevel (context, DC_LOGLEVEL_ALL);
|
||||
dc_context_set_loglevel (context, loglevel);
|
||||
dc_context_set_logfunc (context, logfunc, NULL);
|
||||
|
||||
/* Search for a matching device descriptor. */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user