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

master
Andrzej Rybczak 17 years ago
parent 497f2dd4ff
commit a32f701617
  1. 7
      src/ncmpcpp.cpp

@ -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;

Loading…
Cancel
Save