From 38103aaac5d77161858e021dbf94061aa82e00f4 Mon Sep 17 00:00:00 2001 From: hagen Date: Mon, 28 Mar 2016 14:00:00 +0000 Subject: [PATCH] * logger: explicit allow log output --- Daemon.cpp | 1 + Log.cpp | 3 --- Log.h | 3 +++ api.cpp | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Daemon.cpp b/Daemon.cpp index d4803195..3adfdb71 100644 --- a/Daemon.cpp +++ b/Daemon.cpp @@ -111,6 +111,7 @@ namespace i2p } else { // use stdout -- default } + i2p::log::Logger().Ready(); LogPrint(eLogInfo, "i2pd v", VERSION, " starting"); LogPrint(eLogDebug, "FS: main config file: ", config); diff --git a/Log.cpp b/Log.cpp index 9dd75d6b..06aabac5 100644 --- a/Log.cpp +++ b/Log.cpp @@ -127,7 +127,6 @@ namespace log { m_Logfile = path; m_Destination = eLogFile; m_LogStream = os; - m_IsReady = true; return; } LogPrint(eLogError, "Log: can't open file ", path); @@ -135,7 +134,6 @@ namespace log { void Log::SendTo (std::shared_ptr os) { m_Destination = eLogStream; - m_IsReady = true; m_LogStream = os; } @@ -143,7 +141,6 @@ namespace log { void Log::SendTo(const char *name, int facility) { m_Destination = eLogSyslog; m_LogStream = nullptr; - m_IsReady = true; openlog(name, LOG_CONS | LOG_PID, facility); } #endif diff --git a/Log.h b/Log.h index ba755ae4..6cda62f6 100644 --- a/Log.h +++ b/Log.h @@ -118,6 +118,9 @@ namespace log { */ void Append(std::shared_ptr &); + /** @brief Allow log output */ + void Ready() { m_IsReady = true; } + /** @brief Flushes the output log stream */ void Flush(); diff --git a/api.cpp b/api.cpp index 3bef3f8e..64648743 100644 --- a/api.cpp +++ b/api.cpp @@ -43,6 +43,7 @@ namespace api i2p::log::Logger().SendTo (logStream); else i2p::log::Logger().SendTo (i2p::fs::DataDirPath (i2p::fs::GetAppName () + ".log")); + i2p::log::Logger().Ready(); LogPrint(eLogInfo, "API: starting NetDB"); i2p::data::netdb.Start(); LogPrint(eLogInfo, "API: starting Transports");