Skip to content

Commit

Permalink
log to file if daemon only
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Jul 2, 2014
1 parent 334c92b commit 8aaaf26
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
19 changes: 12 additions & 7 deletions Daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,18 @@ namespace i2p
// initialize log
if (isLogging)
{
std::string logfile_path = i2p::util::filesystem::GetDataDir().string();
#ifndef _WIN32
logfile_path.append("/debug.log");
#else
logfile_path.append("\\debug.log");
#endif
StartLog (logfile_path);
if (isDaemon)
{
std::string logfile_path = i2p::util::filesystem::GetDataDir().string();
#ifndef _WIN32
logfile_path.append("/debug.log");
#else
logfile_path.append("\\debug.log");
#endif
StartLog (logfile_path);
}
else
StartLog (""); // write to stdout
}

d.httpServer = new i2p::util::HTTPServer(i2p::util::config::GetArg("-httpport", 7070));
Expand Down
3 changes: 2 additions & 1 deletion Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ inline void StartLog (const std::string& fullFilePath)
if (!g_Log)
{
g_Log = new Log ();
g_Log->SetLogFile (fullFilePath);
if (fullFilePath.length () > 0)
g_Log->SetLogFile (fullFilePath);
}
}

Expand Down

0 comments on commit 8aaaf26

Please sign in to comment.