mirror of
https://github.com/binary-kitchen/doorlockd
synced 2024-12-22 10:24:26 +01:00
Doorlockd: Replace logfile by logdir
In future, we might have several different logfiles. Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
This commit is contained in:
parent
3721259f3e
commit
f713ef6124
@ -59,7 +59,7 @@ set(CMAKE_CXX_FLAGS "-O2 -Wall -pedantic -Wextra -Weffc++ -Wno-unused-result")
|
|||||||
set(CMAKE_C_FLAGS_DEBUG "-O0 -ggdb -Wall -pedantic -Wextra -Wno-unused-result")
|
set(CMAKE_C_FLAGS_DEBUG "-O0 -ggdb -Wall -pedantic -Wextra -Wno-unused-result")
|
||||||
set(CMAKE_C_FLAGS "-O2 -Wall -pedantic -Wextra -Wno-unused-result")
|
set(CMAKE_C_FLAGS "-O2 -Wall -pedantic -Wextra -Wno-unused-result")
|
||||||
|
|
||||||
find_package(Boost 1.55.0 COMPONENTS program_options system REQUIRED)
|
find_package(Boost 1.55.0 COMPONENTS filesystem program_options system REQUIRED)
|
||||||
|
|
||||||
set(JSON_INCLUDE_DIR "/usr/include/jsoncpp" CACHE PATH "path to jsoncpp includes")
|
set(JSON_INCLUDE_DIR "/usr/include/jsoncpp" CACHE PATH "path to jsoncpp includes")
|
||||||
|
|
||||||
|
@ -23,10 +23,12 @@
|
|||||||
#define DEFAULT_LDAP_URI "ldaps://ldap1.binary.kitchen/ ldaps://ldap2.binary.kitchen/ ldaps://ldapm.binary.kitchen/"
|
#define DEFAULT_LDAP_URI "ldaps://ldap1.binary.kitchen/ ldaps://ldap2.binary.kitchen/ ldaps://ldapm.binary.kitchen/"
|
||||||
#define DEFAULT_BINDDN "cn=%s,ou=people,dc=binary-kitchen,dc=de"
|
#define DEFAULT_BINDDN "cn=%s,ou=people,dc=binary-kitchen,dc=de"
|
||||||
#define DEFAULT_TOKEN_LENGTH 6
|
#define DEFAULT_TOKEN_LENGTH 6
|
||||||
#define DEFAULT_LOG_FILE "/var/log/doorlockd.log"
|
#define DEFAULT_LOG_DIR "/var/log/"
|
||||||
#define DEFAULT_SERIAL_DEVICE "/dev/ttyAMA0"
|
#define DEFAULT_SERIAL_DEVICE "/dev/ttyAMA0"
|
||||||
#define DEFAULT_SERIAL_BAUDRATE 9600UL
|
#define DEFAULT_SERIAL_BAUDRATE 9600UL
|
||||||
|
|
||||||
|
#define LOG_FILENAME "doorlockd.log"
|
||||||
|
|
||||||
#define SHARED_LOCATION "@CMAKE_INSTALL_PREFIX@/share/doorlockd/"
|
#define SHARED_LOCATION "@CMAKE_INSTALL_PREFIX@/share/doorlockd/"
|
||||||
|
|
||||||
#define IMAGE_LOCATION SHARED_LOCATION "images/"
|
#define IMAGE_LOCATION SHARED_LOCATION "images/"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <csignal>
|
#include <csignal>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
|
||||||
@ -12,6 +13,7 @@
|
|||||||
|
|
||||||
namespace po = boost::program_options;
|
namespace po = boost::program_options;
|
||||||
namespace ba = boost::asio;
|
namespace ba = boost::asio;
|
||||||
|
namespace fs = boost::filesystem;
|
||||||
using ba::ip::tcp;
|
using ba::ip::tcp;
|
||||||
|
|
||||||
// Info about doorlockd version
|
// Info about doorlockd version
|
||||||
@ -162,6 +164,7 @@ int main(int argc, char** argv)
|
|||||||
std::string ldapUri;
|
std::string ldapUri;
|
||||||
std::string bindDN;
|
std::string bindDN;
|
||||||
std::string lockPagePrefix;
|
std::string lockPagePrefix;
|
||||||
|
fs::path logdir;
|
||||||
std::string logfile;
|
std::string logfile;
|
||||||
unsigned int tokenLength;
|
unsigned int tokenLength;
|
||||||
std::string serDev;
|
std::string serDev;
|
||||||
@ -191,8 +194,8 @@ int main(int argc, char** argv)
|
|||||||
("tokenLength,t",
|
("tokenLength,t",
|
||||||
po::value<unsigned int>(&tokenLength)->default_value(DEFAULT_TOKEN_LENGTH),
|
po::value<unsigned int>(&tokenLength)->default_value(DEFAULT_TOKEN_LENGTH),
|
||||||
"Token length")
|
"Token length")
|
||||||
("logfile,l",
|
("logdir,l",
|
||||||
po::value<std::string>(&logfile)->default_value(DEFAULT_LOG_FILE),
|
po::value<fs::path>(&logdir)->default_value(DEFAULT_LOG_DIR),
|
||||||
"Log file")
|
"Log file")
|
||||||
("serial,i",
|
("serial,i",
|
||||||
po::value<std::string>(&serDev)->default_value(DEFAULT_SERIAL_DEVICE),
|
po::value<std::string>(&serDev)->default_value(DEFAULT_SERIAL_DEVICE),
|
||||||
@ -215,6 +218,8 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
tokenTimeout = std::chrono::seconds(timeout);
|
tokenTimeout = std::chrono::seconds(timeout);
|
||||||
|
|
||||||
|
logfile = (logdir / LOG_FILENAME).string();
|
||||||
|
|
||||||
l.setLogFile(logfile);
|
l.setLogFile(logfile);
|
||||||
l.logFile(true);
|
l.logFile(true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user