redirect std::cerr output to ~/.ncmpcpp/error.log file

This commit is contained in:
Andrzej Rybczak
2008-12-25 18:00:46 +01:00
parent 497f2dd4ff
commit a32f701617

View File

@@ -22,7 +22,7 @@
#include <csignal>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <map>
#include "mpdpp.h"
@@ -352,6 +352,10 @@ int main(int argc, char *argv[])
signal(SIGPIPE, SIG_IGN);
// redirect std::cerr output to ~/.ncmpcpp/error.log file
std::ofstream errorlog((config_dir + "error.log").c_str(), std::ios::app);
std::cerr.rdbuf(errorlog.rdbuf());
# ifdef HAVE_CURL_CURL_H
pthread_attr_t attr_detached;
pthread_attr_init(&attr_detached);
@@ -3602,6 +3606,7 @@ int main(int argc, char *argv[])
// key mapping end
}
errorlog.close();
Mpd->Disconnect();
DestroyScreen();
return 0;