Redo logging

This commit is contained in:
dogeystamp 2022-05-23 12:27:00 -04:00
parent f1ff5330d9
commit 0a1fa331f8
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
3 changed files with 13 additions and 7 deletions

View File

@ -35,12 +35,12 @@ static const linkStruct links[] = {
/* /*
* 0: Fatal errors * 0: Fatal errors
* 1: Errors * 1: Errors
* 2: Warnings * 2: Normal output
* 3: Info messages * 3: Info messages
* 4: Verbose mode * 4: Verbose mode
*/ */
static const int logLevel = 3; static const int logLevel = 2;
// Set the maximum amount of redirects curl will follow. // Set the maximum amount of redirects curl will follow.
// Use 0 to disable redirects, and -1 for no limit. // Use 0 to disable redirects, and -1 for no limit.

View File

@ -82,7 +82,7 @@ itemAction(itemStruct *item, const char *folder)
} }
if (newItems) if (newItems)
logMsg(2, "%d new articles for feed %s.\n", newItems, folder); logMsg(2, "%s : %d new articles\n", folder, newItems);
} }
void void
@ -99,7 +99,7 @@ finish(char *url, long responseCode)
} }
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
if (argc == 2 && !strcmp("-v", argv[1])) if (argc == 2 && !strcmp("-v", argv[1]))
logMsg(0, "MinRSS %s\n", VERSION); logMsg(0, "MinRSS %s\n", VERSION);
@ -126,7 +126,7 @@ main(int argc, char *argv[])
logMsg(3, "Finished downloads.\n"); logMsg(3, "Finished downloads.\n");
for (i = 0; i < LEN(links); i++) { for (i = 0; i < LEN(links); i++) {
logMsg(4, "Parsing %s\n", links[i].url); logMsg(5, "Parsing %s\n", links[i].url);
if (outputs[i].buffer && outputs[i].buffer[0]) { if (outputs[i].buffer && outputs[i].buffer[0]) {
readDoc(outputs[i].buffer, links[i].feedName, itemAction); readDoc(outputs[i].buffer, links[i].feedName, itemAction);

10
util.c
View File

@ -23,8 +23,14 @@ logMsg(int lvl, char *msg, ...)
va_list args; va_list args;
va_start(args, msg); va_start(args, msg);
if (lvl <= logLevel) if (lvl <= logLevel) {
vfprintf(stderr, msg, args); if (lvl == 2) {
vfprintf(stdout, msg, args);
} else {
vfprintf(stderr, msg, args);
fprintf(stderr, "minrss: ");
}
}
va_end(args); va_end(args);