mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 03:37:49 +02:00
#355. reopen log file by SIGHUP
This commit is contained in:
parent
7ca1cfab1a
commit
98d5e0b56d
3 changed files with 22 additions and 3 deletions
11
Log.cpp
11
Log.cpp
|
@ -46,6 +46,7 @@ void Log::Flush ()
|
|||
|
||||
void Log::SetLogFile (const std::string& fullFilePath)
|
||||
{
|
||||
m_FullFilePath = fullFilePath;
|
||||
auto logFile = std::make_shared<std::ofstream> (fullFilePath, std::ofstream::out | std::ofstream::binary | std::ofstream::trunc);
|
||||
if (logFile->is_open ())
|
||||
{
|
||||
|
@ -54,6 +55,16 @@ void Log::SetLogFile (const std::string& fullFilePath)
|
|||
}
|
||||
}
|
||||
|
||||
void Log::ReopenLogFile ()
|
||||
{
|
||||
if (m_FullFilePath.length () > 0)
|
||||
{
|
||||
SetLogFile (m_FullFilePath);
|
||||
LogPrint(eLogInfo, "Log: file ", m_FullFilePath, " reopen");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Log::SetLogLevel (const std::string& level)
|
||||
{
|
||||
if (level == "error") { m_MinLevel = eLogError; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue