mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-13 12:56:38 +01:00
log to file if daemon only
This commit is contained in:
parent
334c92bb49
commit
8aaaf26a9e
2 changed files with 14 additions and 8 deletions
11
Daemon.cpp
11
Daemon.cpp
|
@ -66,15 +66,20 @@ namespace i2p
|
||||||
{
|
{
|
||||||
// initialize log
|
// initialize log
|
||||||
if (isLogging)
|
if (isLogging)
|
||||||
|
{
|
||||||
|
if (isDaemon)
|
||||||
{
|
{
|
||||||
std::string logfile_path = i2p::util::filesystem::GetDataDir().string();
|
std::string logfile_path = i2p::util::filesystem::GetDataDir().string();
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
logfile_path.append("/debug.log");
|
logfile_path.append("/debug.log");
|
||||||
#else
|
#else
|
||||||
logfile_path.append("\\debug.log");
|
logfile_path.append("\\debug.log");
|
||||||
#endif
|
#endif
|
||||||
StartLog (logfile_path);
|
StartLog (logfile_path);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
StartLog (""); // write to stdout
|
||||||
|
}
|
||||||
|
|
||||||
d.httpServer = new i2p::util::HTTPServer(i2p::util::config::GetArg("-httpport", 7070));
|
d.httpServer = new i2p::util::HTTPServer(i2p::util::config::GetArg("-httpport", 7070));
|
||||||
d.httpServer->Start();
|
d.httpServer->Start();
|
||||||
|
|
1
Log.h
1
Log.h
|
@ -44,6 +44,7 @@ inline void StartLog (const std::string& fullFilePath)
|
||||||
if (!g_Log)
|
if (!g_Log)
|
||||||
{
|
{
|
||||||
g_Log = new Log ();
|
g_Log = new Log ();
|
||||||
|
if (fullFilePath.length () > 0)
|
||||||
g_Log->SetLogFile (fullFilePath);
|
g_Log->SetLogFile (fullFilePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue