void daemonize(bool); ///< Configure whether to run in fore- or background
bool daemon(); ///< \c true, if running as daemon
- void consoleLog(std::string, StdStream which = Both); ///< Configure console log file
+ void consoleLog(std::string const &, StdStream which = Both);
+ ///< Configure console log file
/**< May be called multiple times to set the log file
for stdout and stderr seperately. Any standard stream
not assigned to a log file will be redirected to
When running in the foreground, the log files will be
ignored. */
- void pidFile(std::string, bool unique = true); ///< Configure pid file
+ void pidFile(std::string const &); ///< Configure pid file
///\}
///\name Auxiliary helpers
protected:
Daemon();
+ virtual void configure(); ///< Called before forking to configure the daemon class
+
# ifdef DOXYGEN
protected:
# else
private:
# endif
- virtual void configure(); ///< Called before forking to configure the daemon class
virtual void main(); ///< Called after forking to execute the main application
/**< The default implementation will call init(), detach()
and then run(). It is preferred to override init() and
implementation is not overridden. */
private:
+ void openLog();
void fork();
- void pidfileCreate();
+ bool pidfileCreate();
int argc_;
char const ** argv_;
bool daemonize_;
+ std::string stdoutLog_;
+ std::string stderrLog_;
int stdout_;
int stderr_;
std::string pidfile_;
- bool unique_;
bool detached_;
};