mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
control logs destination through -log parameter
This commit is contained in:
parent
cfd7f1571b
commit
6d8b0e3a5d
23
Daemon.cpp
23
Daemon.cpp
@ -68,7 +68,7 @@ namespace i2p
|
|||||||
i2p::util::config::ReadConfigFile(i2p::util::filesystem::GetConfigFile());
|
i2p::util::config::ReadConfigFile(i2p::util::filesystem::GetConfigFile());
|
||||||
|
|
||||||
isDaemon = i2p::util::config::GetArg("-daemon", 0);
|
isDaemon = i2p::util::config::GetArg("-daemon", 0);
|
||||||
isLogging = i2p::util::config::GetArg("-log", 1);
|
isLogging = i2p::util::config::GetArg("-log", (int)isDaemon);
|
||||||
|
|
||||||
int port = i2p::util::config::GetArg("-port", 0);
|
int port = i2p::util::config::GetArg("-port", 0);
|
||||||
if (port)
|
if (port)
|
||||||
@ -104,22 +104,19 @@ namespace i2p
|
|||||||
{
|
{
|
||||||
// initialize log
|
// initialize log
|
||||||
if (isLogging)
|
if (isLogging)
|
||||||
{
|
{
|
||||||
if (isDaemon)
|
std::string logfile_path = IsService () ? "/var/log/i2pd" : i2p::util::filesystem::GetDataDir().string();
|
||||||
{
|
|
||||||
std::string logfile_path = IsService () ? "/var/log/i2pd" : i2p::util::filesystem::GetDataDir().string();
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
logfile_path.append("/i2pd.log");
|
logfile_path.append("/i2pd.log");
|
||||||
#else
|
#else
|
||||||
logfile_path.append("\\i2pd.log");
|
logfile_path.append("\\i2pd.log");
|
||||||
#endif
|
#endif
|
||||||
StartLog (logfile_path);
|
StartLog (logfile_path);
|
||||||
} else {
|
|
||||||
StartLog (""); // write to stdout
|
|
||||||
}
|
|
||||||
g_Log->SetLogLevel(i2p::util::config::GetArg("-loglevel", "info"));
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
StartLog (""); // write to stdout
|
||||||
|
g_Log->SetLogLevel(i2p::util::config::GetArg("-loglevel", "info"));
|
||||||
|
|
||||||
std::string httpAddr = i2p::util::config::GetArg("-httpaddress", "127.0.0.1");
|
std::string httpAddr = i2p::util::config::GetArg("-httpaddress", "127.0.0.1");
|
||||||
uint16_t httpPort = i2p::util::config::GetArg("-httpport", 7070);
|
uint16_t httpPort = i2p::util::config::GetArg("-httpport", 7070);
|
||||||
LogPrint(eLogInfo, "Daemon: staring HTTP Server at ", httpAddr, ":", httpPort);
|
LogPrint(eLogInfo, "Daemon: staring HTTP Server at ", httpAddr, ":", httpPort);
|
||||||
|
@ -4,14 +4,13 @@ i2pd configuration
|
|||||||
Command line options
|
Command line options
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
* --host= - The external IP (deprecated).
|
|
||||||
* --port= - The port to listen on
|
* --port= - The port to listen on
|
||||||
* --httpaddress= - The address to listen on (HTTP server)
|
* --httpaddress= - The address to listen on (HTTP server)
|
||||||
* --httpport= - The port to listen on (HTTP server)
|
* --httpport= - The port to listen on (HTTP server)
|
||||||
* --log= - Enable or disable logging to file. 1 for yes, 0 for no.
|
|
||||||
* --loglevel= - Log messages above this level (debug, *info, warn, error)
|
* --loglevel= - Log messages above this level (debug, *info, warn, error)
|
||||||
* --pidfile= - Where to write pidfile (dont write by default)
|
* --pidfile= - Where to write pidfile (dont write by default)
|
||||||
* --daemon= - Enable or disable daemon mode. 1 for yes, 0 for no.
|
* --daemon= - Enable or disable daemon mode. 1 for yes, 0 for no. 0 by default
|
||||||
|
* --log= - Enable or disable logging to the file. 1 for daemon, 0 for non-daemon by default
|
||||||
* --svcctl= - Windows service management (--svcctl="install" or --svcctl="remove")
|
* --svcctl= - Windows service management (--svcctl="install" or --svcctl="remove")
|
||||||
* --service= - 1 if uses system folders (/var/run/i2pd.pid, /var/log/i2pd/i2pd.log, /var/lib/i2pd).
|
* --service= - 1 if uses system folders (/var/run/i2pd.pid, /var/log/i2pd/i2pd.log, /var/lib/i2pd).
|
||||||
* --v6= - 1 if supports communication through ipv6, off by default
|
* --v6= - 1 if supports communication through ipv6, off by default
|
||||||
|
Loading…
x
Reference in New Issue
Block a user