summarylogtreecommitdiffstats
path: root/ps-log_messages_all.patch
diff options
context:
space:
mode:
Diffstat (limited to 'ps-log_messages_all.patch')
-rw-r--r--ps-log_messages_all.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/ps-log_messages_all.patch b/ps-log_messages_all.patch
new file mode 100644
index 000000000000..045f1d963a9e
--- /dev/null
+++ b/ps-log_messages_all.patch
@@ -0,0 +1,33 @@
+--- a/src/core/manager.cc 2017-04-30 20:32:33.000000000 +0100
++++ b/src/core/manager.cc 2018-04-20 15:45:33.380910446 +0100
+@@ -36,6 +36,7 @@
+
+ #include "config.h"
+
++#include <ctime>
+ #include <cstdio>
+ #include <cstring>
+ #include <fstream>
+@@ -83,6 +84,22 @@ void
+ Manager::push_log(const char* msg) {
+ m_log_important->lock_and_push_log(msg, strlen(msg), 0);
+ m_log_complete->lock_and_push_log(msg, strlen(msg), 0);
++
++ extern int log_messages_fd;
++ if (log_messages_fd >= 0) {
++ char buf[30];
++ time_t t = std::time(0);
++ std::tm* now = std::localtime(&t);
++
++ snprintf(buf, sizeof(buf), "%04u-%02u-%02u %2d:%02d:%02d ",
++ 1900 + now->tm_year, now->tm_mon + 1, now->tm_mday,
++ now->tm_hour, now->tm_min, now->tm_sec);
++
++ std::string line(buf);
++ line += msg;
++ line += '\n';
++ ::write(log_messages_fd, line.c_str(), line.length());
++ }
+ }
+
+ Manager::Manager() :