mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +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
8
Log.h
8
Log.h
|
@ -39,6 +39,7 @@ class Log: public i2p::util::MsgQueue<LogMsg>
|
|||
~Log () {};
|
||||
|
||||
void SetLogFile (const std::string& fullFilePath);
|
||||
void ReopenLogFile ();
|
||||
void SetLogLevel (const std::string& level);
|
||||
void SetLogStream (std::shared_ptr<std::ostream> logStream);
|
||||
std::shared_ptr<std::ostream> GetLogStream () const { return m_LogStream; };
|
||||
|
@ -51,6 +52,7 @@ class Log: public i2p::util::MsgQueue<LogMsg>
|
|||
|
||||
private:
|
||||
|
||||
std::string m_FullFilePath; // empty if stream
|
||||
std::shared_ptr<std::ostream> m_LogStream;
|
||||
enum LogLevel m_MinLevel;
|
||||
std::string m_Timestamp;
|
||||
|
@ -102,6 +104,12 @@ inline void SetLogLevel (const std::string& level)
|
|||
g_Log->SetLogLevel(level);
|
||||
}
|
||||
|
||||
inline void ReopenLogFile ()
|
||||
{
|
||||
if (g_Log)
|
||||
g_Log->ReopenLogFile ();
|
||||
}
|
||||
|
||||
template<typename TValue>
|
||||
void LogPrint (std::stringstream& s, TValue arg)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue