mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2024-11-17 21:26:04 +00:00
proccess loglevel and logfile correctly
This commit is contained in:
parent
8de15c9d0d
commit
4ced1e5075
22
Daemon.cpp
22
Daemon.cpp
@ -81,9 +81,8 @@ namespace i2p
|
|||||||
|
|
||||||
// temporary hack
|
// temporary hack
|
||||||
std::string logs = "";
|
std::string logs = "";
|
||||||
i2p::config::GetOption("log", logs);
|
i2p::config::GetOption("log", logs);
|
||||||
if (logs != "")
|
if (isDaemon || logs != "") isLogging = true;
|
||||||
isLogging = true;
|
|
||||||
|
|
||||||
uint16_t port; i2p::config::GetOption("port", port);
|
uint16_t port; i2p::config::GetOption("port", port);
|
||||||
if (port)
|
if (port)
|
||||||
@ -135,18 +134,17 @@ namespace i2p
|
|||||||
|
|
||||||
bool Daemon_Singleton::start()
|
bool Daemon_Singleton::start()
|
||||||
{
|
{
|
||||||
|
std::string loglevel = ""; i2p::config::GetOption("loglevel", loglevel);
|
||||||
|
|
||||||
if (isLogging)
|
if (isLogging)
|
||||||
{
|
{
|
||||||
// set default to stdout
|
// set default to stdout
|
||||||
std::string logfile = ""; i2p::config::GetOption("logfile", logfile);
|
std::string logfile = ""; i2p::config::GetOption("logfile", logfile);
|
||||||
std::string loglevel = ""; i2p::config::GetOption("loglevel", loglevel);
|
|
||||||
if (isDaemon && logfile == "") {
|
if (logfile == "")
|
||||||
|
{
|
||||||
// can't log to stdout, use autodetect of logfile
|
// can't log to stdout, use autodetect of logfile
|
||||||
if (IsService ()) {
|
logfile = IsService () ? "/var/log" : i2p::util::filesystem::GetDataDir().string();
|
||||||
logfile = "/var/log";
|
|
||||||
} else {
|
|
||||||
logfile = i2p::util::filesystem::GetDataDir().string();
|
|
||||||
}
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
logfile.append("/i2pd.log");
|
logfile.append("/i2pd.log");
|
||||||
#else
|
#else
|
||||||
@ -154,9 +152,9 @@ namespace i2p
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
StartLog (logfile);
|
StartLog (logfile);
|
||||||
g_Log->SetLogLevel(loglevel);
|
|
||||||
}
|
}
|
||||||
|
g_Log->SetLogLevel(loglevel);
|
||||||
|
|
||||||
bool http; i2p::config::GetOption("http.enabled", http);
|
bool http; i2p::config::GetOption("http.enabled", http);
|
||||||
if (http) {
|
if (http) {
|
||||||
std::string httpAddr; i2p::config::GetOption("http.address", httpAddr);
|
std::string httpAddr; i2p::config::GetOption("http.address", httpAddr);
|
||||||
|
Loading…
Reference in New Issue
Block a user