daemonize() is not responsible for loggers

This commit is contained in:
Sebastian Meßmer 2015-10-17 18:30:07 +02:00
parent 870e5a8e26
commit 829a768e82
3 changed files with 3 additions and 8 deletions

View File

@ -4,7 +4,7 @@
cryptopp/cryptopp: 9
google/gmock: 4
google/gtest: 11
messmer/cmake: 4
messmer/cmake: 3
messmer/spdlog: 0
[parent]

View File

@ -18,7 +18,7 @@ namespace cpputils {
//TODO Test daemonize()
void daemonize(const std::string &daemonName) {
void daemonize() {
pid_t pid = fork();
if (pid < 0) {
exit(EXIT_FAILURE);
@ -44,9 +44,6 @@ namespace cpputils {
exit(EXIT_FAILURE);
}
// Setup logging to syslog.
cpputils::logging::setLogger(spdlog::syslog_logger(daemonName, daemonName, LOG_PID));
// Close out the standard file descriptors. The daemon can't use them anyhow.
close(STDIN_FILENO);
close(STDOUT_FILENO);

View File

@ -2,10 +2,8 @@
#ifndef MESSMER_CPPUTILS_DAEMON_DAEMONIZE_H
#define MESSMER_CPPUTILS_DAEMON_DAEMONIZE_H
#include <string>
namespace cpputils {
void daemonize(const std::string &daemonName);
void daemonize();
}
#endif