Browse Source

* logger: explicit allow log output

pull/448/head
hagen 9 years ago
parent
commit
38103aaac5
  1. 1
      Daemon.cpp
  2. 3
      Log.cpp
  3. 3
      Log.h
  4. 1
      api.cpp

1
Daemon.cpp

@ -111,6 +111,7 @@ namespace i2p
} else { } else {
// use stdout -- default // use stdout -- default
} }
i2p::log::Logger().Ready();
LogPrint(eLogInfo, "i2pd v", VERSION, " starting"); LogPrint(eLogInfo, "i2pd v", VERSION, " starting");
LogPrint(eLogDebug, "FS: main config file: ", config); LogPrint(eLogDebug, "FS: main config file: ", config);

3
Log.cpp

@ -127,7 +127,6 @@ namespace log {
m_Logfile = path; m_Logfile = path;
m_Destination = eLogFile; m_Destination = eLogFile;
m_LogStream = os; m_LogStream = os;
m_IsReady = true;
return; return;
} }
LogPrint(eLogError, "Log: can't open file ", path); LogPrint(eLogError, "Log: can't open file ", path);
@ -135,7 +134,6 @@ namespace log {
void Log::SendTo (std::shared_ptr<std::ostream> os) { void Log::SendTo (std::shared_ptr<std::ostream> os) {
m_Destination = eLogStream; m_Destination = eLogStream;
m_IsReady = true;
m_LogStream = os; m_LogStream = os;
} }
@ -143,7 +141,6 @@ namespace log {
void Log::SendTo(const char *name, int facility) { void Log::SendTo(const char *name, int facility) {
m_Destination = eLogSyslog; m_Destination = eLogSyslog;
m_LogStream = nullptr; m_LogStream = nullptr;
m_IsReady = true;
openlog(name, LOG_CONS | LOG_PID, facility); openlog(name, LOG_CONS | LOG_PID, facility);
} }
#endif #endif

3
Log.h

@ -118,6 +118,9 @@ namespace log {
*/ */
void Append(std::shared_ptr<i2p::log::LogMsg> &); void Append(std::shared_ptr<i2p::log::LogMsg> &);
/** @brief Allow log output */
void Ready() { m_IsReady = true; }
/** @brief Flushes the output log stream */ /** @brief Flushes the output log stream */
void Flush(); void Flush();

1
api.cpp

@ -43,6 +43,7 @@ namespace api
i2p::log::Logger().SendTo (logStream); i2p::log::Logger().SendTo (logStream);
else else
i2p::log::Logger().SendTo (i2p::fs::DataDirPath (i2p::fs::GetAppName () + ".log")); i2p::log::Logger().SendTo (i2p::fs::DataDirPath (i2p::fs::GetAppName () + ".log"));
i2p::log::Logger().Ready();
LogPrint(eLogInfo, "API: starting NetDB"); LogPrint(eLogInfo, "API: starting NetDB");
i2p::data::netdb.Start(); i2p::data::netdb.Start();
LogPrint(eLogInfo, "API: starting Transports"); LogPrint(eLogInfo, "API: starting Transports");

Loading…
Cancel
Save