redirect std::cerr output to ~/.ncmpcpp/error.log file
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
#include <csignal>
|
#include <csignal>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <fstream>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "mpdpp.h"
|
#include "mpdpp.h"
|
||||||
@@ -352,6 +352,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
signal(SIGPIPE, SIG_IGN);
|
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
|
# ifdef HAVE_CURL_CURL_H
|
||||||
pthread_attr_t attr_detached;
|
pthread_attr_t attr_detached;
|
||||||
pthread_attr_init(&attr_detached);
|
pthread_attr_init(&attr_detached);
|
||||||
@@ -3602,6 +3606,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// key mapping end
|
// key mapping end
|
||||||
}
|
}
|
||||||
|
errorlog.close();
|
||||||
Mpd->Disconnect();
|
Mpd->Disconnect();
|
||||||
DestroyScreen();
|
DestroyScreen();
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user