Redo logging
This commit is contained in:
parent
f1ff5330d9
commit
0a1fa331f8
@ -35,12 +35,12 @@ static const linkStruct links[] = {
|
||||
/*
|
||||
* 0: Fatal errors
|
||||
* 1: Errors
|
||||
* 2: Warnings
|
||||
* 2: Normal output
|
||||
* 3: Info messages
|
||||
* 4: Verbose mode
|
||||
*/
|
||||
|
||||
static const int logLevel = 3;
|
||||
static const int logLevel = 2;
|
||||
|
||||
// Set the maximum amount of redirects curl will follow.
|
||||
// Use 0 to disable redirects, and -1 for no limit.
|
||||
|
6
minrss.c
6
minrss.c
@ -82,7 +82,7 @@ itemAction(itemStruct *item, const char *folder)
|
||||
}
|
||||
|
||||
if (newItems)
|
||||
logMsg(2, "%d new articles for feed %s.\n", newItems, folder);
|
||||
logMsg(2, "%s : %d new articles\n", folder, newItems);
|
||||
}
|
||||
|
||||
void
|
||||
@ -99,7 +99,7 @@ finish(char *url, long responseCode)
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
if (argc == 2 && !strcmp("-v", argv[1]))
|
||||
logMsg(0, "MinRSS %s\n", VERSION);
|
||||
@ -126,7 +126,7 @@ main(int argc, char *argv[])
|
||||
logMsg(3, "Finished downloads.\n");
|
||||
|
||||
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]) {
|
||||
readDoc(outputs[i].buffer, links[i].feedName, itemAction);
|
||||
|
10
util.c
10
util.c
@ -23,8 +23,14 @@ logMsg(int lvl, char *msg, ...)
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
|
||||
if (lvl <= logLevel)
|
||||
vfprintf(stderr, msg, args);
|
||||
if (lvl <= logLevel) {
|
||||
if (lvl == 2) {
|
||||
vfprintf(stdout, msg, args);
|
||||
} else {
|
||||
vfprintf(stderr, msg, args);
|
||||
fprintf(stderr, "minrss: ");
|
||||
}
|
||||
}
|
||||
|
||||
va_end(args);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user