Add WARNING log method. it's the same as ERROR, except that when mpd starts,

warnings are buffered until the error log is opened, and then flushed to the
error log.

git-svn-id: https://svn.musicpd.org/mpd/trunk@1442 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Warren Dukes
2004-06-12 02:06:16 +00:00
parent 43255a7f63
commit 43b355734c
11 changed files with 106 additions and 38 deletions

View File

@@ -289,7 +289,10 @@ void changeToUser(Options * options) {
}
void openLogFiles(Options * options, FILE ** out, FILE ** err) {
if(options->stdOutput) return;
if(options->stdOutput) {
flushWarningLog();
return;
}
if(NULL==(*out=fopen(options->logFile,"a"))) {
ERROR("problem opening file \"%s\" for writing\n",
@@ -316,6 +319,7 @@ void openDB(Options * options, char * argv0) {
argv0);
exit(EXIT_FAILURE);
}
flushWarningLog();
initMp3Directory();
if(writeDirectoryDB()<0) {
ERROR("problem opening db for reading or writing\n");
@@ -324,6 +328,7 @@ void openDB(Options * options, char * argv0) {
if(options->createDB) exit(EXIT_SUCCESS);
}
if(options->updateDB) {
flushWarningLog();
updateMp3Directory();
exit(EXIT_SUCCESS);
}
@@ -379,6 +384,7 @@ void setupLogOutput(Options * options, FILE * out, FILE * err) {
myfprintfStdLogMode(out, err, options->logFile,
options->errorFile);
flushWarningLog();
}
/* lets redirect stdin to dev null as a work around for libao bug */