summaryrefslogtreecommitdiff
path: root/src/syncevo/LogRedirect.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/syncevo/LogRedirect.h')
-rw-r--r--src/syncevo/LogRedirect.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/syncevo/LogRedirect.h b/src/syncevo/LogRedirect.h
index 5b762ab4..65f7498f 100644
--- a/src/syncevo/LogRedirect.h
+++ b/src/syncevo/LogRedirect.h
@@ -132,6 +132,11 @@ class LogRedirect : public LoggerStdout
void init();
public:
+ enum Mode {
+ STDERR_AND_STDOUT,
+ STDERR
+ };
+
/**
* Redirect both stderr and stdout or just stderr,
* using UDP so that we don't block when not reading
@@ -140,16 +145,23 @@ class LogRedirect : public LoggerStdout
* messagev() only writes messages to the previous stdout
* or the optional file which pass the filtering (relevant,
* suppress known errors, ...).
+ *
+ * May only be called when there is no other active LogRedirect
+ * instance. Not thread-safe, in contrast to the actual logging
+ * method and redirect handling.
+ *
+ * Does not add or remove the logger from the logger stack.
+ * That must be done by the caller.
*/
- LogRedirect(bool both = true, const char *filename = NULL) throw();
+ LogRedirect(Mode mode, const char *filename = NULL);
~LogRedirect() throw();
+ virtual void remove() throw();
+
/**
- * re-initialize redirection after a fork:
- * - closes inherited file descriptors, except for the original output file descriptor
- * - sets up new sockets
+ * Remove redirection (if any) after a fork and before an exec.
*/
- void redoRedirect() throw();
+ static void removeRedirect() throw();
/**
* Meant to be used for redirecting output of a specific command