Skip to content

Commit 171fd2b

Browse files
committed
logging to logfile only happens now if a --logfile argument is supplied. Logging to stderr always happens.
1 parent e35438d commit 171fd2b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/cliap2.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ usage(char *program)
145145
printf("Usage: %s [options]\n\n", program);
146146
printf("Options:\n");
147147
printf(" --loglevel <number> Log level (0-5)\n");
148+
printf(" --logfile <filename> Log filename. Not supplying this argument will result in logging to stderr only.\n");
148149
printf(" --logdomains <dom,dom..> Log domains\n");
149150
printf(" --config <file> Use <file> as the configuration file\n");
150151
printf(" --name <name> Name of the airplay 2 device\n");
@@ -522,6 +523,7 @@ main(int argc, char **argv)
522523

523524
struct option option_map[] = {
524525
{ "loglevel", 1, NULL, 500 },
526+
{ "logfile", 1, NULL, 516 },
525527
{ "logdomains", 1, NULL, 501 },
526528
{ "config", 1, NULL, 502 },
527529
{ "name", 1, NULL, 503 },
@@ -555,6 +557,10 @@ main(int argc, char **argv)
555557
loglevel = option;
556558
break;
557559

560+
case 516: // logfile
561+
logfile = optarg;
562+
break;
563+
558564
case 501: // logdomains
559565
logdomains = optarg;
560566
break;
@@ -681,7 +687,6 @@ main(int argc, char **argv)
681687
loglevel = cfg_getint(cfg_getsec(cfg, "general"), "loglevel");
682688
if (!logformat)
683689
logformat = cfg_getstr(cfg_getsec(cfg, "general"), "logformat");
684-
logfile = cfg_getstr(cfg_getsec(cfg, "general"), "logfile");
685690

686691
ret = logger_init(logfile, logdomains, loglevel, logformat);
687692
if (ret != 0) {

0 commit comments

Comments
 (0)