mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
Use setter method for m_TimeFormat, set time format in Daemon.cpp instead of Log.cpp
This commit is contained in:
parent
d500fe66fd
commit
681810ea38
@ -94,8 +94,12 @@ namespace i2p
|
|||||||
std::string logs = ""; i2p::config::GetOption("log", logs);
|
std::string logs = ""; i2p::config::GetOption("log", logs);
|
||||||
std::string logfile = ""; i2p::config::GetOption("logfile", logfile);
|
std::string logfile = ""; i2p::config::GetOption("logfile", logfile);
|
||||||
std::string loglevel = ""; i2p::config::GetOption("loglevel", loglevel);
|
std::string loglevel = ""; i2p::config::GetOption("loglevel", loglevel);
|
||||||
|
bool logclftime; i2p::config::GetOption("logclftime", logclftime);
|
||||||
|
|
||||||
/* setup logging */
|
/* setup logging */
|
||||||
|
if (logclftime)
|
||||||
|
i2p::log::Logger().SetTimeFormat ("[%d/%b/%Y:%H:%M:%S %z]");
|
||||||
|
|
||||||
if (isDaemon && (logs == "" || logs == "stdout"))
|
if (isDaemon && (logs == "" || logs == "stdout"))
|
||||||
logs = "file";
|
logs = "file";
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "Config.h"
|
|
||||||
|
|
||||||
namespace i2p {
|
namespace i2p {
|
||||||
namespace log {
|
namespace log {
|
||||||
@ -74,8 +73,6 @@ namespace log {
|
|||||||
if (!m_IsRunning)
|
if (!m_IsRunning)
|
||||||
{
|
{
|
||||||
m_IsRunning = true;
|
m_IsRunning = true;
|
||||||
bool logclftime; i2p::config::GetOption("logclftime", logclftime);
|
|
||||||
if (logclftime) m_TimeFormat = "[%d/%b/%Y:%H:%M:%S %z]";
|
|
||||||
m_Thread = new std::thread (std::bind (&Log::Run, this));
|
m_Thread = new std::thread (std::bind (&Log::Run, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,6 +108,12 @@ namespace log {
|
|||||||
*/
|
*/
|
||||||
void SendTo (std::shared_ptr<std::ostream> os);
|
void SendTo (std::shared_ptr<std::ostream> os);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets format for timestamps in log
|
||||||
|
* @param format String with timestamp format
|
||||||
|
*/
|
||||||
|
void SetTimeFormat (std::string format) { m_TimeFormat = format; };
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
/**
|
/**
|
||||||
* @brief Sets log destination to syslog
|
* @brief Sets log destination to syslog
|
||||||
|
Loading…
Reference in New Issue
Block a user