Browse Source

Merge pull request #1910 from wekoq/critical_log_level

Add critical log level
pull/1911/head
orignal 2 years ago committed by GitHub
parent
commit
b42be2b391
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Win32/DaemonWin32.cpp
  2. 18
      Win32/Win32Service.cpp
  3. 2
      contrib/i2pd.conf
  4. 6
      daemon/Daemon.cpp
  5. 13
      daemon/HTTPServer.cpp
  6. 2
      daemon/UnixDaemon.cpp
  7. 14
      libi2pd/Destination.cpp
  8. 2
      libi2pd/LeaseSet.cpp
  9. 30
      libi2pd/Log.cpp
  10. 1
      libi2pd/Log.h
  11. 6
      libi2pd/NTCP2.cpp
  12. 14
      libi2pd/Reseed.cpp
  13. 4
      libi2pd/SSU2.cpp
  14. 8
      libi2pd/Transports.cpp
  15. 2
      libi2pd_client/AddressBook.cpp
  16. 20
      libi2pd_client/ClientContext.cpp

2
Win32/DaemonWin32.cpp

@ -47,7 +47,7 @@ namespace util
I2PService service((PSTR)SERVICE_NAME); I2PService service((PSTR)SERVICE_NAME);
if (!I2PService::Run(service)) if (!I2PService::Run(service))
{ {
LogPrint(eLogError, "Daemon: Service failed to run w/err 0x%08lx\n", GetLastError()); LogPrint(eLogCritical, "Daemon: Service failed to run w/err 0x%08lx\n", GetLastError());
return false; return false;
} }
return false; return false;

18
Win32/Win32Service.cpp

@ -119,12 +119,12 @@ void I2PService::Start(DWORD dwArgc, PSTR *pszArgv)
} }
catch (DWORD dwError) catch (DWORD dwError)
{ {
LogPrint(eLogError, "Win32Service: Start error: ", dwError); LogPrint(eLogCritical, "Win32Service: Start error: ", dwError);
SetServiceStatus(SERVICE_STOPPED, dwError); SetServiceStatus(SERVICE_STOPPED, dwError);
} }
catch (...) catch (...)
{ {
LogPrint(eLogError, "Win32Service: failed to start: ", EVENTLOG_ERROR_TYPE); LogPrint(eLogCritical, "Win32Service: failed to start: ", EVENTLOG_ERROR_TYPE);
SetServiceStatus(SERVICE_STOPPED); SetServiceStatus(SERVICE_STOPPED);
} }
} }
@ -162,7 +162,7 @@ void I2PService::Stop()
} }
catch (...) catch (...)
{ {
LogPrint(eLogError, "Win32Service: Failed to stop: ", EVENTLOG_ERROR_TYPE); LogPrint(eLogCritical, "Win32Service: Failed to stop: ", EVENTLOG_ERROR_TYPE);
SetServiceStatus(dwOriginalState); SetServiceStatus(dwOriginalState);
} }
} }
@ -191,12 +191,12 @@ void I2PService::Pause()
} }
catch (DWORD dwError) catch (DWORD dwError)
{ {
LogPrint(eLogError, "Win32Service: Pause error: ", dwError); LogPrint(eLogCritical, "Win32Service: Pause error: ", dwError);
SetServiceStatus(SERVICE_RUNNING); SetServiceStatus(SERVICE_RUNNING);
} }
catch (...) catch (...)
{ {
LogPrint(eLogError, "Win32Service: Failed to pause: ", EVENTLOG_ERROR_TYPE); LogPrint(eLogCritical, "Win32Service: Failed to pause: ", EVENTLOG_ERROR_TYPE);
SetServiceStatus(SERVICE_RUNNING); SetServiceStatus(SERVICE_RUNNING);
} }
} }
@ -215,12 +215,12 @@ void I2PService::Continue()
} }
catch (DWORD dwError) catch (DWORD dwError)
{ {
LogPrint(eLogError, "Win32Service: Continue error: ", dwError); LogPrint(eLogCritical, "Win32Service: Continue error: ", dwError);
SetServiceStatus(SERVICE_PAUSED); SetServiceStatus(SERVICE_PAUSED);
} }
catch (...) catch (...)
{ {
LogPrint(eLogError, "Win32Service: Failed to resume: ", EVENTLOG_ERROR_TYPE); LogPrint(eLogCritical, "Win32Service: Failed to resume: ", EVENTLOG_ERROR_TYPE);
SetServiceStatus(SERVICE_PAUSED); SetServiceStatus(SERVICE_PAUSED);
} }
} }
@ -238,11 +238,11 @@ void I2PService::Shutdown()
} }
catch (DWORD dwError) catch (DWORD dwError)
{ {
LogPrint(eLogError, "Win32Service: Shutdown error: ", dwError); LogPrint(eLogCritical, "Win32Service: Shutdown error: ", dwError);
} }
catch (...) catch (...)
{ {
LogPrint(eLogError, "Win32Service: Failed to shut down: ", EVENTLOG_ERROR_TYPE); LogPrint(eLogCritical, "Win32Service: Failed to shut down: ", EVENTLOG_ERROR_TYPE);
} }
} }

2
contrib/i2pd.conf

@ -33,7 +33,7 @@
# log = file # log = file
## Path to logfile (default - autodetect) ## Path to logfile (default - autodetect)
# logfile = /var/log/i2pd/i2pd.log # logfile = /var/log/i2pd/i2pd.log
## Log messages above this level (debug, info, *warn, error, none) ## Log messages above this level (debug, info, *warn, error, critical, none)
## If you set it to none, logging will be disabled ## If you set it to none, logging will be disabled
# loglevel = warn # loglevel = warn
## Write full CLF-formatted date and time to log (default: write only time) ## Write full CLF-formatted date and time to log (default: write only time)

6
daemon/Daemon.cpp

@ -310,7 +310,7 @@ namespace util
LogPrint(eLogInfo, "Daemon: Transports started"); LogPrint(eLogInfo, "Daemon: Transports started");
else else
{ {
LogPrint(eLogError, "Daemon: Failed to start Transports"); LogPrint(eLogCritical, "Daemon: Failed to start Transports");
/** shut down netdb right away */ /** shut down netdb right away */
i2p::transport::transports.Stop(); i2p::transport::transports.Stop();
i2p::data::netdb.Stop(); i2p::data::netdb.Stop();
@ -329,7 +329,7 @@ namespace util
} }
catch (std::exception& ex) catch (std::exception& ex)
{ {
LogPrint (eLogError, "Daemon: Failed to start Webconsole: ", ex.what ()); LogPrint (eLogCritical, "Daemon: Failed to start Webconsole: ", ex.what ());
ThrowFatal ("Unable to start webconsole at ", httpAddr, ":", httpPort, ": ", ex.what ()); ThrowFatal ("Unable to start webconsole at ", httpAddr, ":", httpPort, ": ", ex.what ());
} }
} }
@ -356,7 +356,7 @@ namespace util
} }
catch (std::exception& ex) catch (std::exception& ex)
{ {
LogPrint (eLogError, "Daemon: Failed to start I2PControl: ", ex.what ()); LogPrint (eLogCritical, "Daemon: Failed to start I2PControl: ", ex.what ());
ThrowFatal ("Unable to start I2PControl service at ", i2pcpAddr, ":", i2pcpPort, ": ", ex.what ()); ThrowFatal ("Unable to start I2PControl service at ", i2pcpAddr, ":", i2pcpPort, ": ", ex.what ());
} }
} }

13
daemon/HTTPServer.cpp

@ -156,7 +156,7 @@ namespace http {
static void SetLogLevel (const std::string& level) static void SetLogLevel (const std::string& level)
{ {
if (level == "none" || level == "error" || level == "warn" || level == "info" || level == "debug") if (level == "none" || level == "critical" || level == "error" || level == "warn" || level == "info" || level == "debug")
i2p::log::Logger().SetLogLevel(level); i2p::log::Logger().SetLogLevel(level);
else { else {
LogPrint(eLogError, "HTTPServer: Unknown loglevel set attempted"); LogPrint(eLogError, "HTTPServer: Unknown loglevel set attempted");
@ -748,11 +748,12 @@ namespace http {
auto loglevel = i2p::log::Logger().GetLogLevel(); auto loglevel = i2p::log::Logger().GetLogLevel();
s << "<b>" << tr("Logging level") << "</b><br>\r\n"; s << "<b>" << tr("Logging level") << "</b><br>\r\n";
s << " <a class=\"button" << (loglevel == eLogNone ? " selected" : "") << "\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_LOGLEVEL << "&level=none&token=" << token << "\"> none </a> \r\n"; s << " <a class=\"button" << (loglevel == eLogNone ? " selected" : "") << "\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_LOGLEVEL << "&level=none&token=" << token << "\"> none </a> \r\n";
s << " <a class=\"button" << (loglevel == eLogError ? " selected" : "") << "\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_LOGLEVEL << "&level=error&token=" << token << "\"> error </a> \r\n"; s << " <a class=\"button" << (loglevel == eLogCritical ? " selected" : "") << "\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_LOGLEVEL << "&level=critical&token=" << token << "\"> critical </a> \r\n";
s << " <a class=\"button" << (loglevel == eLogWarning ? " selected" : "") << "\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_LOGLEVEL << "&level=warn&token=" << token << "\"> warn </a> \r\n"; s << " <a class=\"button" << (loglevel == eLogError ? " selected" : "") << "\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_LOGLEVEL << "&level=error&token=" << token << "\"> error </a> \r\n";
s << " <a class=\"button" << (loglevel == eLogInfo ? " selected" : "") << "\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_LOGLEVEL << "&level=info&token=" << token << "\"> info </a> \r\n"; s << " <a class=\"button" << (loglevel == eLogWarning ? " selected" : "") << "\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_LOGLEVEL << "&level=warn&token=" << token << "\"> warn </a> \r\n";
s << " <a class=\"button" << (loglevel == eLogDebug ? " selected" : "") << "\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_LOGLEVEL << "&level=debug&token=" << token << "\"> debug </a><br>\r\n<br>\r\n"; s << " <a class=\"button" << (loglevel == eLogInfo ? " selected" : "") << "\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_LOGLEVEL << "&level=info&token=" << token << "\"> info </a> \r\n";
s << " <a class=\"button" << (loglevel == eLogDebug ? " selected" : "") << "\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_LOGLEVEL << "&level=debug&token=" << token << "\"> debug </a><br>\r\n<br>\r\n";
uint16_t maxTunnels = i2p::tunnel::tunnels.GetMaxNumTransitTunnels (); uint16_t maxTunnels = i2p::tunnel::tunnels.GetMaxNumTransitTunnels ();
s << "<b>" << tr("Transit tunnels limit") << "</b><br>\r\n"; s << "<b>" << tr("Transit tunnels limit") << "</b><br>\r\n";

2
daemon/UnixDaemon.cpp

@ -173,7 +173,7 @@ namespace i2p
ftruncate(pidFH, 0); ftruncate(pidFH, 0);
if (write(pidFH, pid, strlen(pid)) < 0) if (write(pidFH, pid, strlen(pid)) < 0)
{ {
LogPrint(eLogError, "Daemon: Could not write pidfile ", pidfile, ": ", strerror(errno)); LogPrint(eLogCritical, "Daemon: Could not write pidfile ", pidfile, ": ", strerror(errno));
std::cerr << "i2pd: Could not write pidfile " << pidfile << ": " << strerror(errno) << std::endl; std::cerr << "i2pd: Could not write pidfile " << pidfile << ": " << strerror(errno) << std::endl;
return false; return false;
} }

14
libi2pd/Destination.cpp

@ -108,7 +108,7 @@ namespace client
if (authType >= i2p::data::ENCRYPTED_LEASESET_AUTH_TYPE_NONE && authType <= i2p::data::ENCRYPTED_LEASESET_AUTH_TYPE_PSK) if (authType >= i2p::data::ENCRYPTED_LEASESET_AUTH_TYPE_NONE && authType <= i2p::data::ENCRYPTED_LEASESET_AUTH_TYPE_PSK)
m_AuthType = authType; m_AuthType = authType;
else else
LogPrint (eLogError, "Destination: Unknown auth type ", authType); LogPrint (eLogError, "Destination: Unknown auth type: ", authType);
} }
} }
it = params->find (I2CP_PARAM_LEASESET_PRIV_KEY); it = params->find (I2CP_PARAM_LEASESET_PRIV_KEY);
@ -117,7 +117,7 @@ namespace client
m_LeaseSetPrivKey.reset (new i2p::data::Tag<32>()); m_LeaseSetPrivKey.reset (new i2p::data::Tag<32>());
if (m_LeaseSetPrivKey->FromBase64 (it->second) != 32) if (m_LeaseSetPrivKey->FromBase64 (it->second) != 32)
{ {
LogPrint(eLogError, "Destination: Invalid value i2cp.leaseSetPrivKey ", it->second); LogPrint(eLogCritical, "Destination: Invalid value i2cp.leaseSetPrivKey: ", it->second);
m_LeaseSetPrivKey.reset (nullptr); m_LeaseSetPrivKey.reset (nullptr);
} }
} }
@ -1014,12 +1014,12 @@ namespace client
else if (authType == i2p::data::ENCRYPTED_LEASESET_AUTH_TYPE_PSK) else if (authType == i2p::data::ENCRYPTED_LEASESET_AUTH_TYPE_PSK)
ReadAuthKey (I2CP_PARAM_LEASESET_CLIENT_PSK, params); ReadAuthKey (I2CP_PARAM_LEASESET_CLIENT_PSK, params);
else else
LogPrint (eLogError, "Destination: Unexpected auth type ", authType); LogPrint (eLogError, "Destination: Unexpected auth type: ", authType);
if (m_AuthKeys->size ()) if (m_AuthKeys->size ())
LogPrint (eLogInfo, "Destination: ", m_AuthKeys->size (), " auth keys read"); LogPrint (eLogInfo, "Destination: ", m_AuthKeys->size (), " auth keys read");
else else
{ {
LogPrint (eLogError, "Destination: No auth keys read for auth type ", authType); LogPrint (eLogCritical, "Destination: No auth keys read for auth type: ", authType);
m_AuthKeys = nullptr; m_AuthKeys = nullptr;
} }
} }
@ -1028,7 +1028,7 @@ namespace client
} }
catch (std::exception & ex) catch (std::exception & ex)
{ {
LogPrint(eLogError, "Destination: Unable to parse parameters for destination: ", ex.what()); LogPrint(eLogCritical, "Destination: Unable to parse parameters for destination: ", ex.what());
} }
} }
@ -1336,7 +1336,7 @@ namespace client
f1.write ((char *)keys->priv, 256); f1.write ((char *)keys->priv, 256);
return; return;
} }
LogPrint(eLogError, "Destinations: Can't save keys to ", path); LogPrint(eLogCritical, "Destinations: Can't save keys to ", path);
} }
void ClientDestination::CreateNewLeaseSet (const std::vector<std::shared_ptr<i2p::tunnel::InboundTunnel> >& tunnels) void ClientDestination::CreateNewLeaseSet (const std::vector<std::shared_ptr<i2p::tunnel::InboundTunnel> >& tunnels)
@ -1413,7 +1413,7 @@ namespace client
if (pubKey.FromBase64 (it.second.substr (pos+1))) if (pubKey.FromBase64 (it.second.substr (pos+1)))
m_AuthKeys->push_back (pubKey); m_AuthKeys->push_back (pubKey);
else else
LogPrint (eLogError, "Destination: Unexpected auth key ", it.second.substr (pos+1)); LogPrint (eLogCritical, "Destination: Unexpected auth key: ", it.second.substr (pos+1));
} }
} }
} }

2
libi2pd/LeaseSet.cpp

@ -76,7 +76,7 @@ namespace data
LogPrint (eLogDebug, "LeaseSet: Read num=", (int)num); LogPrint (eLogDebug, "LeaseSet: Read num=", (int)num);
if (!num || num > MAX_NUM_LEASES) if (!num || num > MAX_NUM_LEASES)
{ {
LogPrint (eLogError, "LeaseSet: Rncorrect number of leases", (int)num); LogPrint (eLogError, "LeaseSet: Incorrect number of leases", (int)num);
m_IsValid = false; m_IsValid = false;
return; return;
} }

30
libi2pd/Log.cpp

@ -20,11 +20,12 @@ namespace log {
*/ */
static const char *g_LogLevelStr[eNumLogLevels] = static const char *g_LogLevelStr[eNumLogLevels] =
{ {
"none", // eLogNone "none", // eLogNone
"error", // eLogError "critical", // eLogCritical
"warn", // eLogWarning "error", // eLogError
"info", // eLogInfo "warn", // eLogWarning
"debug" // eLogDebug "info", // eLogInfo
"debug" // eLogDebug
}; };
/** /**
@ -32,10 +33,11 @@ namespace log {
* @note Using ISO 6429 (ANSI) color sequences * @note Using ISO 6429 (ANSI) color sequences
*/ */
#ifdef _WIN32 #ifdef _WIN32
static const char *LogMsgColors[] = { "", "", "", "", "", "" }; static const char *LogMsgColors[] = { "", "", "", "", "", "", "" };
#else /* UNIX */ #else /* UNIX */
static const char *LogMsgColors[] = { static const char *LogMsgColors[] = {
"\033[1;32m", /* none: green */ "\033[1;32m", /* none: green */
"\033[1;41m", /* critical: red background */
"\033[1;31m", /* error: red */ "\033[1;31m", /* error: red */
"\033[1;33m", /* warning: yellow */ "\033[1;33m", /* warning: yellow */
"\033[1;36m", /* info: cyan */ "\033[1;36m", /* info: cyan */
@ -53,6 +55,7 @@ namespace log {
int priority = LOG_DEBUG; int priority = LOG_DEBUG;
switch (l) { switch (l) {
case eLogNone : priority = LOG_CRIT; break; case eLogNone : priority = LOG_CRIT; break;
case eLogCritical: priority = LOG_CRIT; break;
case eLogError : priority = LOG_ERR; break; case eLogError : priority = LOG_ERR; break;
case eLogWarning : priority = LOG_WARNING; break; case eLogWarning : priority = LOG_WARNING; break;
case eLogInfo : priority = LOG_INFO; break; case eLogInfo : priority = LOG_INFO; break;
@ -123,13 +126,14 @@ namespace log {
void Log::SetLogLevel (const std::string& level_) { void Log::SetLogLevel (const std::string& level_) {
std::string level=str_tolower(level_); std::string level=str_tolower(level_);
if (level == "none") { m_MinLevel = eLogNone; } if (level == "none") { m_MinLevel = eLogNone; }
else if (level == "error") { m_MinLevel = eLogError; } else if (level == "critical") { m_MinLevel = eLogCritical; }
else if (level == "warn") { m_MinLevel = eLogWarning; } else if (level == "error") { m_MinLevel = eLogError; }
else if (level == "info") { m_MinLevel = eLogInfo; } else if (level == "warn") { m_MinLevel = eLogWarning; }
else if (level == "debug") { m_MinLevel = eLogDebug; } else if (level == "info") { m_MinLevel = eLogInfo; }
else if (level == "debug") { m_MinLevel = eLogDebug; }
else { else {
LogPrint(eLogError, "Log: Unknown loglevel: ", level); LogPrint(eLogCritical, "Log: Unknown loglevel: ", level);
return; return;
} }
LogPrint(eLogInfo, "Log: Logging level set to ", level); LogPrint(eLogInfo, "Log: Logging level set to ", level);
@ -212,7 +216,7 @@ namespace log {
m_LogStream = os; m_LogStream = os;
return; return;
} }
LogPrint(eLogError, "Log: Can't open file ", path); LogPrint(eLogCritical, "Log: Can't open file ", path);
} }
void Log::SendTo (std::shared_ptr<std::ostream> os) { void Log::SendTo (std::shared_ptr<std::ostream> os) {

1
libi2pd/Log.h

@ -27,6 +27,7 @@
enum LogLevel enum LogLevel
{ {
eLogNone = 0, eLogNone = 0,
eLogCritical,
eLogError, eLogError,
eLogWarning, eLogWarning,
eLogInfo, eLogInfo,

6
libi2pd/NTCP2.cpp

@ -1242,7 +1242,7 @@ namespace transport
boost::system::error_code e; boost::system::error_code e;
auto itr = m_Resolver.resolve(q, e); auto itr = m_Resolver.resolve(q, e);
if(e) if(e)
LogPrint(eLogError, "NTCP2: Failed to resolve proxy ", e.message()); LogPrint(eLogCritical, "NTCP2: Failed to resolve proxy ", e.message());
else else
{ {
m_ProxyEndpoint.reset (new boost::asio::ip::tcp::endpoint(*itr)); m_ProxyEndpoint.reset (new boost::asio::ip::tcp::endpoint(*itr));
@ -1270,7 +1270,7 @@ namespace transport
} }
catch ( std::exception & ex ) catch ( std::exception & ex )
{ {
LogPrint(eLogError, "NTCP2: Failed to bind to v4 port ", address->port, ex.what()); LogPrint(eLogCritical, "NTCP2: Failed to bind to v4 port ", address->port, ex.what());
ThrowFatal ("Unable to start IPv4 NTCP2 transport at port ", address->port, ": ", ex.what ()); ThrowFatal ("Unable to start IPv4 NTCP2 transport at port ", address->port, ": ", ex.what ());
continue; continue;
} }
@ -1313,7 +1313,7 @@ namespace transport
} }
catch ( std::exception & ex ) catch ( std::exception & ex )
{ {
LogPrint(eLogError, "NTCP2: Failed to bind to v6 port ", address->port, ": ", ex.what()); LogPrint(eLogCritical, "NTCP2: Failed to bind to v6 port ", address->port, ": ", ex.what());
ThrowFatal ("Unable to start IPv6 NTCP2 transport at port ", address->port, ": ", ex.what ()); ThrowFatal ("Unable to start IPv6 NTCP2 transport at port ", address->port, ": ", ex.what ());
continue; continue;
} }

14
libi2pd/Reseed.cpp

@ -153,7 +153,7 @@ namespace data
return ProcessSU3Stream (s); return ProcessSU3Stream (s);
else else
{ {
LogPrint (eLogError, "Reseed: Can't open file ", filename); LogPrint (eLogCritical, "Reseed: Can't open file ", filename);
return 0; return 0;
} }
} }
@ -170,7 +170,7 @@ namespace data
} }
else else
{ {
LogPrint (eLogError, "Reseed: Can't open file ", filename); LogPrint (eLogCritical, "Reseed: Can't open file ", filename);
return 0; return 0;
} }
} }
@ -278,7 +278,7 @@ namespace data
if (verify) // not verified if (verify) // not verified
{ {
LogPrint (eLogError, "Reseed: SU3 verification failed"); LogPrint (eLogCritical, "Reseed: SU3 verification failed");
return 0; return 0;
} }
@ -492,7 +492,7 @@ namespace data
SSL_free (ssl); SSL_free (ssl);
} }
else else
LogPrint (eLogError, "Reseed: Can't open certificate file ", filename); LogPrint (eLogCritical, "Reseed: Can't open certificate file ", filename);
SSL_CTX_free (ctx); SSL_CTX_free (ctx);
} }
@ -534,17 +534,17 @@ namespace data
} }
// check for valid proxy url schema // check for valid proxy url schema
if (proxyUrl.schema != "http" && proxyUrl.schema != "socks") { if (proxyUrl.schema != "http" && proxyUrl.schema != "socks") {
LogPrint(eLogError, "Reseed: Bad proxy url: ", proxy); LogPrint(eLogCritical, "Reseed: Bad proxy url: ", proxy);
return ""; return "";
} }
} else { } else {
LogPrint(eLogError, "Reseed: Bad proxy url: ", proxy); LogPrint(eLogCritical, "Reseed: Bad proxy url: ", proxy);
return ""; return "";
} }
} }
i2p::http::URL url; i2p::http::URL url;
if (!url.parse(address)) { if (!url.parse(address)) {
LogPrint(eLogError, "Reseed: Failed to parse url: ", address); LogPrint(eLogCritical, "Reseed: Failed to parse url: ", address);
return ""; return "";
} }
url.schema = "https"; url.schema = "https";

4
libi2pd/SSU2.cpp

@ -99,7 +99,7 @@ namespace transport
} }
} }
else else
LogPrint (eLogError, "SSU2: Can't start server because port not specified"); LogPrint (eLogCritical, "SSU2: Can't start server because port not specified");
} }
} }
if (found) if (found)
@ -224,7 +224,7 @@ namespace transport
} }
catch (std::exception& ex ) catch (std::exception& ex )
{ {
LogPrint (eLogError, "SSU2: Failed to bind to ", localEndpoint, ": ", ex.what()); LogPrint (eLogCritical, "SSU2: Failed to bind to ", localEndpoint, ": ", ex.what());
ThrowFatal ("Unable to start SSU2 transport on ", localEndpoint, ": ", ex.what ()); ThrowFatal ("Unable to start SSU2 transport on ", localEndpoint, ": ", ex.what ());
} }
return socket; return socket;

8
libi2pd/Transports.cpp

@ -200,10 +200,10 @@ namespace transport
i2p::context.SetStatusV6 (eRouterStatusProxy); i2p::context.SetStatusV6 (eRouterStatusProxy);
} }
else else
LogPrint(eLogError, "Transports: Unsupported NTCP2 proxy URL ", ntcp2proxy); LogPrint(eLogCritical, "Transports: Unsupported NTCP2 proxy URL ", ntcp2proxy);
} }
else else
LogPrint(eLogError, "Transports: Invalid NTCP2 proxy URL ", ntcp2proxy); LogPrint(eLogCritical, "Transports: Invalid NTCP2 proxy URL ", ntcp2proxy);
} }
else else
m_NTCP2Server = new NTCP2Server (); m_NTCP2Server = new NTCP2Server ();
@ -225,10 +225,10 @@ namespace transport
i2p::context.SetStatusV6 (eRouterStatusProxy); i2p::context.SetStatusV6 (eRouterStatusProxy);
} }
else else
LogPrint(eLogError, "Transports: Can't set SSU2 proxy ", ssu2proxy); LogPrint(eLogCritical, "Transports: Can't set SSU2 proxy ", ssu2proxy);
} }
else else
LogPrint(eLogError, "Transports: Invalid SSU2 proxy URL ", ssu2proxy); LogPrint(eLogCritical, "Transports: Invalid SSU2 proxy URL ", ssu2proxy);
} }
} }

2
libi2pd_client/AddressBook.cpp

@ -661,7 +661,7 @@ namespace client
this, std::placeholders::_1)); this, std::placeholders::_1));
} }
else else
LogPrint (eLogError, "Addressbook: Can't start subscriptions: missing shared local destination"); LogPrint (eLogCritical, "Addressbook: Can't start subscriptions: missing shared local destination");
} }
void AddressBook::StopSubscriptions () void AddressBook::StopSubscriptions ()

20
libi2pd_client/ClientContext.cpp

@ -74,7 +74,7 @@ namespace client
} }
catch (std::exception& e) catch (std::exception& e)
{ {
LogPrint(eLogError, "Clients: Exception in SAM bridge: ", e.what()); LogPrint(eLogCritical, "Clients: Exception in SAM bridge: ", e.what());
ThrowFatal ("Unable to start SAM bridge at ", samAddr, ":[", samPortTCP, "|", samPortUDP,"]: ", e.what ()); ThrowFatal ("Unable to start SAM bridge at ", samAddr, ":[", samPortTCP, "|", samPortUDP,"]: ", e.what ());
} }
} }
@ -92,7 +92,7 @@ namespace client
} }
catch (std::exception& e) catch (std::exception& e)
{ {
LogPrint(eLogError, "Clients: Exception in BOB bridge: ", e.what()); LogPrint(eLogCritical, "Clients: Exception in BOB bridge: ", e.what());
ThrowFatal ("Unable to start BOB bridge at ", bobAddr, ":", bobPort, ": ", e.what ()); ThrowFatal ("Unable to start BOB bridge at ", bobAddr, ":", bobPort, ": ", e.what ());
} }
} }
@ -112,7 +112,7 @@ namespace client
} }
catch (std::exception& e) catch (std::exception& e)
{ {
LogPrint(eLogError, "Clients: Exception in I2CP: ", e.what()); LogPrint(eLogCritical, "Clients: Exception in I2CP: ", e.what());
ThrowFatal ("Unable to start I2CP at ", i2cpAddr, ":", i2cpPort, ": ", e.what ()); ThrowFatal ("Unable to start I2CP at ", i2cpAddr, ":", i2cpPort, ": ", e.what ());
} }
} }
@ -279,7 +279,7 @@ namespace client
s.read ((char *)buf, len); s.read ((char *)buf, len);
if(!keys.FromBuffer (buf, len)) if(!keys.FromBuffer (buf, len))
{ {
LogPrint (eLogError, "Clients: Failed to load keyfile ", filename); LogPrint (eLogCritical, "Clients: Failed to load keyfile ", filename);
success = false; success = false;
} }
else else
@ -288,7 +288,7 @@ namespace client
} }
else else
{ {
LogPrint (eLogError, "Clients: Can't open file ", fullPath, " Creating new one with signature type ", sigType, " crypto type ", cryptoType); LogPrint (eLogCritical, "Clients: Can't open file ", fullPath, " Creating new one with signature type ", sigType, " crypto type ", cryptoType);
keys = i2p::data::PrivateKeys::CreateRandomKeys (sigType, cryptoType, true); keys = i2p::data::PrivateKeys::CreateRandomKeys (sigType, cryptoType, true);
std::ofstream f (fullPath, std::ofstream::binary | std::ofstream::out); std::ofstream f (fullPath, std::ofstream::binary | std::ofstream::out);
size_t len = keys.GetFullLen (); size_t len = keys.GetFullLen ();
@ -851,7 +851,7 @@ namespace client
} }
catch (std::exception& ex) catch (std::exception& ex)
{ {
LogPrint (eLogError, "Clients: Can't read tunnel ", name, " params: ", ex.what ()); LogPrint (eLogCritical, "Clients: Can't read tunnel ", name, " params: ", ex.what ());
ThrowFatal ("Unable to start tunnel ", name, ": ", ex.what ()); ThrowFatal ("Unable to start tunnel ", name, ": ", ex.what ());
} }
} }
@ -883,7 +883,7 @@ namespace client
if (localDestination) localDestination->Acquire (); if (localDestination) localDestination->Acquire ();
} }
else else
LogPrint(eLogError, "Clients: Failed to load HTTP Proxy key"); LogPrint(eLogCritical, "Clients: Failed to load HTTP Proxy key");
} }
try try
{ {
@ -892,7 +892,7 @@ namespace client
} }
catch (std::exception& e) catch (std::exception& e)
{ {
LogPrint(eLogError, "Clients: Exception in HTTP Proxy: ", e.what()); LogPrint(eLogCritical, "Clients: Exception in HTTP Proxy: ", e.what());
ThrowFatal ("Unable to start HTTP Proxy at ", httpProxyAddr, ":", httpProxyPort, ": ", e.what ()); ThrowFatal ("Unable to start HTTP Proxy at ", httpProxyAddr, ":", httpProxyPort, ": ", e.what ());
} }
} }
@ -930,7 +930,7 @@ namespace client
if (localDestination) localDestination->Acquire (); if (localDestination) localDestination->Acquire ();
} }
else else
LogPrint(eLogError, "Clients: Failed to load SOCKS Proxy key"); LogPrint(eLogCritical, "Clients: Failed to load SOCKS Proxy key");
} }
try try
{ {
@ -940,7 +940,7 @@ namespace client
} }
catch (std::exception& e) catch (std::exception& e)
{ {
LogPrint(eLogError, "Clients: Exception in SOCKS Proxy: ", e.what()); LogPrint(eLogCritical, "Clients: Exception in SOCKS Proxy: ", e.what());
ThrowFatal ("Unable to start SOCKS Proxy at ", socksProxyAddr, ":", socksProxyPort, ": ", e.what ()); ThrowFatal ("Unable to start SOCKS Proxy at ", socksProxyAddr, ":", socksProxyPort, ": ", e.what ());
} }
} }

Loading…
Cancel
Save