From a80aeb67155f73bc408f6960358a4632e30a4725 Mon Sep 17 00:00:00 2001
From: weko <weko@i2pmail.org>
Date: Thu, 30 Mar 2023 21:31:12 +0000
Subject: [PATCH 1/6] add critical log level

---
 contrib/i2pd.conf |  2 +-
 libi2pd/Log.cpp   | 26 +++++++++++++++-----------
 libi2pd/Log.h     |  1 +
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/contrib/i2pd.conf b/contrib/i2pd.conf
index c6e52c1f..5d09c90a 100644
--- a/contrib/i2pd.conf
+++ b/contrib/i2pd.conf
@@ -33,7 +33,7 @@
 # log = file
 ## Path to logfile (default - autodetect)
 # 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
 # loglevel = warn
 ## Write full CLF-formatted date and time to log (default: write only time)
diff --git a/libi2pd/Log.cpp b/libi2pd/Log.cpp
index 65b00e10..dfb507c9 100644
--- a/libi2pd/Log.cpp
+++ b/libi2pd/Log.cpp
@@ -20,11 +20,12 @@ namespace log {
 	 */
 	static const char *g_LogLevelStr[eNumLogLevels] =
 	{
-		"none",  // eLogNone
-		"error", // eLogError
-		"warn",  // eLogWarning
-		"info",  // eLogInfo
-		"debug"  // eLogDebug
+		"none",     // eLogNone
+		"critical", // eLogCritical
+		"error",    // eLogError
+		"warn",     // eLogWarning
+		"info",     // eLogInfo
+		"debug"     // eLogDebug
 	};
 
 	/**
@@ -32,10 +33,11 @@ namespace log {
 	 * @note Using ISO 6429 (ANSI) color sequences
 	 */
 #ifdef _WIN32
-	static const char *LogMsgColors[] = { "", "", "", "", "", "" };
+	static const char *LogMsgColors[] = { "", "", "", "", "", "", "" };
 #else /* UNIX */
 	static const char *LogMsgColors[] = {
 		"\033[1;32m", /* none:    green */
+		"\033[1;41m", /* critical: red background */
 		"\033[1;31m", /* error:   red */
 		"\033[1;33m", /* warning: yellow */
 		"\033[1;36m", /* info:    cyan */
@@ -53,6 +55,7 @@ namespace log {
 		int priority = LOG_DEBUG;
 		switch (l) {
 			case eLogNone    : priority = LOG_CRIT;    break;
+			case eLogCritical: priority = LOG_CRIT;    break;
 			case eLogError   : priority = LOG_ERR;     break;
 			case eLogWarning : priority = LOG_WARNING; break;
 			case eLogInfo    : priority = LOG_INFO;    break;
@@ -123,11 +126,12 @@ namespace log {
 
 	void Log::SetLogLevel (const std::string& level_) {
 		std::string level=str_tolower(level_);
-		if      (level == "none")  { m_MinLevel = eLogNone; }
-		else if (level == "error") { m_MinLevel = eLogError; }
-		else if (level == "warn")  { m_MinLevel = eLogWarning; }
-		else if (level == "info")  { m_MinLevel = eLogInfo; }
-		else if (level == "debug") { m_MinLevel = eLogDebug; }
+		if      (level == "none")     { m_MinLevel = eLogNone; }
+		else if (level == "critical") { m_MinLevel = eLogCritical}
+		else if (level == "error")    { m_MinLevel = eLogError; }
+		else if (level == "warn")     { m_MinLevel = eLogWarning; }
+		else if (level == "info")     { m_MinLevel = eLogInfo; }
+		else if (level == "debug")    { m_MinLevel = eLogDebug; }
 		else {
 			LogPrint(eLogError, "Log: Unknown loglevel: ", level);
 			return;
diff --git a/libi2pd/Log.h b/libi2pd/Log.h
index 465e10bc..1ec0c5fe 100644
--- a/libi2pd/Log.h
+++ b/libi2pd/Log.h
@@ -27,6 +27,7 @@
 enum LogLevel
 {
 	eLogNone = 0,
+	eLogCritical,
 	eLogError,
 	eLogWarning,
 	eLogInfo,

From 354a04f0f6f03478518148c7172cc37e18470afa Mon Sep 17 00:00:00 2001
From: weko <weko@i2pmail.org>
Date: Fri, 31 Mar 2023 11:29:04 +0000
Subject: [PATCH 2/6] Up level for some logs to critical

---
 Win32/DaemonWin32.cpp            |  2 +-
 Win32/Win32Service.cpp           | 18 +++++++++---------
 daemon/Daemon.cpp                | 12 ++++++------
 daemon/HTTPServer.cpp            | 19 ++++++++++---------
 daemon/I2PControl.cpp            |  2 +-
 daemon/UPnP.cpp                  |  2 +-
 daemon/UnixDaemon.cpp            | 18 +++++++++---------
 libi2pd/Blinding.cpp             |  4 ++--
 libi2pd/Destination.cpp          | 16 ++++++++--------
 libi2pd/Family.cpp               | 12 ++++++------
 libi2pd/Identity.cpp             |  6 +++---
 libi2pd/LeaseSet.cpp             |  2 +-
 libi2pd/Log.cpp                  |  6 +++---
 libi2pd/NTCP2.cpp                |  6 +++---
 libi2pd/Reseed.cpp               | 14 +++++++-------
 libi2pd/SSU2.cpp                 |  4 ++--
 libi2pd/SSU2Session.cpp          | 10 +++++-----
 libi2pd/Transports.cpp           |  8 ++++----
 libi2pd_client/AddressBook.cpp   |  2 +-
 libi2pd_client/ClientContext.cpp | 24 ++++++++++++------------
 libi2pd_client/SAM.cpp           |  2 +-
 21 files changed, 95 insertions(+), 94 deletions(-)

diff --git a/Win32/DaemonWin32.cpp b/Win32/DaemonWin32.cpp
index e8052f14..48f65c27 100644
--- a/Win32/DaemonWin32.cpp
+++ b/Win32/DaemonWin32.cpp
@@ -47,7 +47,7 @@ namespace util
 			I2PService service((PSTR)SERVICE_NAME);
 			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;
diff --git a/Win32/Win32Service.cpp b/Win32/Win32Service.cpp
index a9ecf477..057a1edd 100644
--- a/Win32/Win32Service.cpp
+++ b/Win32/Win32Service.cpp
@@ -119,12 +119,12 @@ void I2PService::Start(DWORD dwArgc, PSTR *pszArgv)
 	}
 	catch (DWORD dwError)
 	{
-		LogPrint(eLogError, "Win32Service: Start error: ", dwError);
+		LogPrint(eLogCritical, "Win32Service: Start error: ", dwError);
 		SetServiceStatus(SERVICE_STOPPED, dwError);
 	}
 	catch (...)
 	{
-		LogPrint(eLogError, "Win32Service: failed to start: ", EVENTLOG_ERROR_TYPE);
+		LogPrint(eLogCritical, "Win32Service: failed to start: ", EVENTLOG_ERROR_TYPE);
 		SetServiceStatus(SERVICE_STOPPED);
 	}
 }
@@ -162,7 +162,7 @@ void I2PService::Stop()
 	}
 	catch (...)
 	{
-		LogPrint(eLogError, "Win32Service: Failed to stop: ", EVENTLOG_ERROR_TYPE);
+		LogPrint(eLogCritical, "Win32Service: Failed to stop: ", EVENTLOG_ERROR_TYPE);
 		SetServiceStatus(dwOriginalState);
 	}
 }
@@ -191,12 +191,12 @@ void I2PService::Pause()
 	}
 	catch (DWORD dwError)
 	{
-		LogPrint(eLogError, "Win32Service: Pause error: ", dwError);
+		LogPrint(eLogCritical, "Win32Service: Pause error: ", dwError);
 		SetServiceStatus(SERVICE_RUNNING);
 	}
 	catch (...)
 	{
-		LogPrint(eLogError, "Win32Service: Failed to pause: ", EVENTLOG_ERROR_TYPE);
+		LogPrint(eLogCritical, "Win32Service: Failed to pause: ", EVENTLOG_ERROR_TYPE);
 		SetServiceStatus(SERVICE_RUNNING);
 	}
 }
@@ -215,12 +215,12 @@ void I2PService::Continue()
 	}
 	catch (DWORD dwError)
 	{
-		LogPrint(eLogError, "Win32Service: Continue error: ", dwError);
+		LogPrint(eLogCritical, "Win32Service: Continue error: ", dwError);
 		SetServiceStatus(SERVICE_PAUSED);
 	}
 	catch (...)
 	{
-		LogPrint(eLogError, "Win32Service: Failed to resume: ", EVENTLOG_ERROR_TYPE);
+		LogPrint(eLogCritical, "Win32Service: Failed to resume: ", EVENTLOG_ERROR_TYPE);
 		SetServiceStatus(SERVICE_PAUSED);
 	}
 }
@@ -238,11 +238,11 @@ void I2PService::Shutdown()
 	}
 	catch (DWORD dwError)
 	{
-		LogPrint(eLogError, "Win32Service: Shutdown error: ", dwError);
+		LogPrint(eLogCritical, "Win32Service: Shutdown error: ", dwError);
 	}
 	catch (...)
 	{
-		LogPrint(eLogError, "Win32Service: Failed to shut down: ", EVENTLOG_ERROR_TYPE);
+		LogPrint(eLogCritical, "Win32Service: Failed to shut down: ", EVENTLOG_ERROR_TYPE);
 	}
 }
 
diff --git a/daemon/Daemon.cpp b/daemon/Daemon.cpp
index 84f197fb..02aee72d 100644
--- a/daemon/Daemon.cpp
+++ b/daemon/Daemon.cpp
@@ -262,7 +262,7 @@ namespace util
 				restricted = idents.size() > 0;
 			}
 			if(!restricted)
-				LogPrint(eLogError, "Daemon: No trusted routers of families specified");
+				LogPrint(eLogCritical, "Daemon: No trusted routers of families specified");
 		}
 
 		bool hidden; i2p::config::GetOption("trust.hidden", hidden);
@@ -310,7 +310,7 @@ namespace util
 			LogPrint(eLogInfo, "Daemon: Transports started");
 		else
 		{
-			LogPrint(eLogError, "Daemon: Failed to start Transports");
+			LogPrint(eLogCritical, "Daemon: Failed to start Transports");
 			/** shut down netdb right away */
 			i2p::transport::transports.Stop();
 			i2p::data::netdb.Stop();
@@ -329,7 +329,7 @@ namespace util
 			}
 			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 ());
 			}
 		}
@@ -338,8 +338,8 @@ namespace util
 		i2p::tunnel::tunnels.Start();
 
 		LogPrint(eLogInfo, "Daemon: Starting Router context");
-		i2p::context.Start();			
-		
+		i2p::context.Start();
+
 		LogPrint(eLogInfo, "Daemon: Starting Client");
 		i2p::client::context.Start ();
 
@@ -356,7 +356,7 @@ namespace util
 			}
 			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 ());
 			}
 		}
diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp
index 29f3f569..8b034332 100644
--- a/daemon/HTTPServer.cpp
+++ b/daemon/HTTPServer.cpp
@@ -156,7 +156,7 @@ namespace http {
 
 	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);
 		else {
 			LogPrint(eLogError, "HTTPServer: Unknown loglevel set attempted");
@@ -625,10 +625,10 @@ namespace http {
 					if (storeType == i2p::data::NETDB_STORE_TYPE_LEASESET)
 						ls.reset (new i2p::data::LeaseSet (leaseSet->GetBuffer(), leaseSet->GetBufferLen()));
 					else
-					{	
+					{
 						ls.reset (new i2p::data::LeaseSet2 (storeType));
 						ls->Update (leaseSet->GetBuffer(), leaseSet->GetBufferLen(), false);
-					}		
+					}
 					if (!ls) return;
 					s << "<div class=\"leaseset listitem";
 					if (ls->IsExpired())
@@ -748,11 +748,12 @@ namespace http {
 
 		auto loglevel = i2p::log::Logger().GetLogLevel();
 		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 == eLogError   ? " selected" : "") << "\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_LOGLEVEL << "&level=error&token=" << token << "\"> error </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 == 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";
+		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 == eLogCritical ? " selected" : "") << "\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_LOGLEVEL << "&level=critical&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 == eLogWarning  ? " selected" : "") << "\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_LOGLEVEL << "&level=warn&token=" << token << "\"> warn </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 == 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 ();
 		s << "<b>" << tr("Transit tunnels limit") << "</b><br>\r\n";
@@ -1481,7 +1482,7 @@ namespace http {
 			}
 			catch (std::exception& ex)
 			{
-				LogPrint (eLogError, "HTTPServer: Runtime exception: ", ex.what ());
+				LogPrint (eLogCritical, "HTTPServer: Runtime exception: ", ex.what ());
 			}
 		}
 	}
diff --git a/daemon/I2PControl.cpp b/daemon/I2PControl.cpp
index da2443fd..354c19d4 100644
--- a/daemon/I2PControl.cpp
+++ b/daemon/I2PControl.cpp
@@ -115,7 +115,7 @@ namespace client
 			try {
 				m_Service.run ();
 			} catch (std::exception& ex) {
-				LogPrint (eLogError, "I2PControl: Runtime exception: ", ex.what ());
+				LogPrint (eLogCritical, "I2PControl: Runtime exception: ", ex.what ());
 			}
 		}
 	}
diff --git a/daemon/UPnP.cpp b/daemon/UPnP.cpp
index dbaf864a..2c915024 100644
--- a/daemon/UPnP.cpp
+++ b/daemon/UPnP.cpp
@@ -72,7 +72,7 @@ namespace transport
 			}
 			catch (std::exception& ex)
 			{
-				LogPrint (eLogError, "UPnP: Runtime exception: ", ex.what ());
+				LogPrint (eLogCritical, "UPnP: Runtime exception: ", ex.what ());
 				PortMapping ();
 			}
 		}
diff --git a/daemon/UnixDaemon.cpp b/daemon/UnixDaemon.cpp
index e6bad5a0..3c17fd14 100644
--- a/daemon/UnixDaemon.cpp
+++ b/daemon/UnixDaemon.cpp
@@ -81,7 +81,7 @@ namespace i2p
 
 				if (pid < 0) // error
 				{
-					LogPrint(eLogError, "Daemon: Could not fork: ", strerror(errno));
+					LogPrint(eLogCritical, "Daemon: Could not fork: ", strerror(errno));
 					std::cerr << "i2pd: Could not fork: " << strerror(errno) << std::endl;
 					return false;
 				}
@@ -91,7 +91,7 @@ namespace i2p
 				int sid = setsid();
 				if (sid < 0)
 				{
-					LogPrint(eLogError, "Daemon: Could not create process group.");
+					LogPrint(eLogCritical, "Daemon: Could not create process group.");
 					std::cerr << "i2pd: Could not create process group." << std::endl;
 					return false;
 				}
@@ -121,10 +121,10 @@ namespace i2p
 					LogPrint(eLogInfo, "Daemon: Set max number of open files to ",
 						nfiles, " (system limit is ", limit.rlim_max, ")");
 				} else {
-					LogPrint(eLogError, "Daemon: Can't set max number of open files: ", strerror(errno));
+					LogPrint(eLogCritical, "Daemon: Can't set max number of open files: ", strerror(errno));
 				}
 			} else {
-				LogPrint(eLogError, "Daemon: limits.openfiles exceeds system limit: ", limit.rlim_max);
+				LogPrint(eLogCritical, "Daemon: limits.openfiles exceeds system limit: ", limit.rlim_max);
 			}
 			uint32_t cfsize; i2p::config::GetOption("limits.coresize", cfsize);
 			if (cfsize) // core file size set
@@ -134,14 +134,14 @@ namespace i2p
 				if (cfsize <= limit.rlim_max) {
 					limit.rlim_cur = cfsize;
 					if (setrlimit(RLIMIT_CORE, &limit) != 0) {
-						LogPrint(eLogError, "Daemon: Can't set max size of coredump: ", strerror(errno));
+						LogPrint(eLogCritical, "Daemon: Can't set max size of coredump: ", strerror(errno));
 					} else if (cfsize == 0) {
 						LogPrint(eLogInfo, "Daemon: coredumps disabled");
 					} else {
 						LogPrint(eLogInfo, "Daemon: Set max size of core files to ", cfsize / 1024, "Kb");
 					}
 				} else {
-					LogPrint(eLogError, "Daemon: limits.coresize exceeds system limit: ", limit.rlim_max);
+					LogPrint(eLogCritical, "Daemon: limits.coresize exceeds system limit: ", limit.rlim_max);
 				}
 			}
 
@@ -155,7 +155,7 @@ namespace i2p
 				pidFH = open(pidfile.c_str(), O_RDWR | O_CREAT, 0600);
 				if (pidFH < 0)
 				{
-					LogPrint(eLogError, "Daemon: Could not create pid file ", pidfile, ": ", strerror(errno));
+					LogPrint(eLogCritical, "Daemon: Could not create pid file ", pidfile, ": ", strerror(errno));
 					std::cerr << "i2pd: Could not create pid file " << pidfile << ": " << strerror(errno) << std::endl;
 					return false;
 				}
@@ -163,7 +163,7 @@ namespace i2p
 #ifndef ANDROID
 				if (lockf(pidFH, F_TLOCK, 0) != 0)
 				{
-					LogPrint(eLogError, "Daemon: Could not lock pid file ", pidfile, ": ", strerror(errno));
+					LogPrint(eLogCritical, "Daemon: Could not lock pid file ", pidfile, ": ", strerror(errno));
 					std::cerr << "i2pd: Could not lock pid file " << pidfile << ": " << strerror(errno) << std::endl;
 					return false;
 				}
@@ -173,7 +173,7 @@ namespace i2p
 				ftruncate(pidFH, 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;
 					return false;
 				}
diff --git a/libi2pd/Blinding.cpp b/libi2pd/Blinding.cpp
index ced086e1..1f15cf14 100644
--- a/libi2pd/Blinding.cpp
+++ b/libi2pd/Blinding.cpp
@@ -259,7 +259,7 @@ namespace data
 				publicKeyLength = i2p::crypto::EDDSA25519_PUBLIC_KEY_LENGTH;
 			break;
 			default:
-				LogPrint (eLogError, "Blinding: Can't blind signature type ", (int)m_SigType);
+				LogPrint (eLogCritical, "Blinding: Can't blind signature type ", (int)m_SigType);
 		}
 		return publicKeyLength;
 	}
@@ -289,7 +289,7 @@ namespace data
 				break;
 			}
 			default:
-				LogPrint (eLogError, "Blinding: Can't blind signature type ", (int)m_SigType);
+				LogPrint (eLogCritical, "Blinding: Can't blind signature type ", (int)m_SigType);
 		}
 		return publicKeyLength;
 	}
diff --git a/libi2pd/Destination.cpp b/libi2pd/Destination.cpp
index b6dbeaed..0be25512 100644
--- a/libi2pd/Destination.cpp
+++ b/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)
 							m_AuthType = authType;
 						else
-							LogPrint (eLogError, "Destination: Unknown auth type ", authType);
+							LogPrint (eLogCritical, "Destination: Unknown auth type ", authType);
 					}
 				}
 				it = params->find (I2CP_PARAM_LEASESET_PRIV_KEY);
@@ -117,7 +117,7 @@ namespace client
 					m_LeaseSetPrivKey.reset (new i2p::data::Tag<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);
 					}
 				}
@@ -125,7 +125,7 @@ namespace client
 		}
 		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());
 		}
 		SetNumTags (numTags);
 		m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (inLen, outLen, inQty, outQty, inVar, outVar);
@@ -1014,12 +1014,12 @@ namespace client
 						else if (authType == i2p::data::ENCRYPTED_LEASESET_AUTH_TYPE_PSK)
 							ReadAuthKey (I2CP_PARAM_LEASESET_CLIENT_PSK, params);
 						else
-							LogPrint (eLogError, "Destination: Unexpected auth type ", authType);
+							LogPrint (eLogCritical, "Destination: Unexpected auth type ", authType);
 						if (m_AuthKeys->size ())
 							LogPrint (eLogInfo, "Destination: ", m_AuthKeys->size (), " auth keys read");
 						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;
 						}
 					}
@@ -1028,7 +1028,7 @@ namespace client
 		}
 		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);
 			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)
@@ -1413,7 +1413,7 @@ namespace client
 				if (pubKey.FromBase64 (it.second.substr (pos+1)))
 					m_AuthKeys->push_back (pubKey);
 				else
-					LogPrint (eLogError, "Destination: Unexpected auth key ", it.second.substr (pos+1));
+					LogPrint (eLogCritical, "Destination: Unexpected auth key ", it.second.substr (pos+1));
 			}
 		}
 	}
diff --git a/libi2pd/Family.cpp b/libi2pd/Family.cpp
index 8c6d3ba4..bca9e231 100644
--- a/libi2pd/Family.cpp
+++ b/libi2pd/Family.cpp
@@ -77,14 +77,14 @@ namespace data
 									verifier->SetPublicKey (signingKey);
 								}
 								else
-									LogPrint (eLogWarning, "Family: elliptic curve ", curve, " is not supported");
+									LogPrint (eLogCritical, "Family: elliptic curve ", curve, " is not supported");
 							}
 							EC_KEY_free (ecKey);
 						}
 						break;
 					}
 					default:
-						LogPrint (eLogWarning, "Family: Certificate key type ", keyType, " is not supported");
+						LogPrint (eLogCritical, "Family: Certificate key type ", keyType, " is not supported");
 				}
 				EVP_PKEY_free (pkey);
 				if (verifier && cn)
@@ -93,7 +93,7 @@ namespace data
 			SSL_free (ssl);
 		}
 		else
-			LogPrint (eLogError, "Family: Can't open certificate file ", filename);
+			LogPrint (eLogCritical, "Family: Can't open certificate file ", filename);
 		SSL_CTX_free (ctx);
 	}
 
@@ -105,7 +105,7 @@ namespace data
 		int numCertificates = 0;
 
 		if (!i2p::fs::ReadDir(certDir, files)) {
-			LogPrint(eLogWarning, "Family: Can't load family certificates from ", certDir);
+			LogPrint(eLogError, "Family: Can't load family certificates from ", certDir);
 			return;
 		}
 
@@ -185,13 +185,13 @@ namespace data
 						delete[] b64;
 					}
 					else
-						LogPrint (eLogWarning, "Family: elliptic curve ", curve, " is not supported");
+						LogPrint (eLogCritical, "Family: elliptic curve ", curve, " is not supported");
 				}
 			}
 			SSL_free (ssl);
 		}
 		else
-			LogPrint (eLogError, "Family: Can't open keys file: ", filename);
+			LogPrint (eLogCritical, "Family: Can't open keys file: ", filename);
 		SSL_CTX_free (ctx);
 		return sig;
 	}
diff --git a/libi2pd/Identity.cpp b/libi2pd/Identity.cpp
index 073d8c06..7a73f02a 100644
--- a/libi2pd/Identity.cpp
+++ b/libi2pd/Identity.cpp
@@ -369,7 +369,7 @@ namespace data
 	void IdentityEx::CreateVerifier ()
 	{
 		if (!m_Verifier)
-		{	
+		{
 			auto verifier = CreateVerifier (GetSigningKeyType ());
 			if (verifier)
 			{
@@ -388,7 +388,7 @@ namespace data
 				}
 			}
 			m_Verifier.reset (verifier);
-		}	
+		}
 	}
 
 	std::shared_ptr<i2p::crypto::CryptoKeyEncryptor> IdentityEx::CreateEncryptor (CryptoKeyType keyType, const uint8_t * key)
@@ -755,7 +755,7 @@ namespace data
 				i2p::crypto::CreateECIESX25519AEADRatchetRandomKeys (priv, pub);
 			break;
 			default:
-				LogPrint (eLogError, "Identity: Crypto key type ", (int)type, " is not supported");
+				LogPrint (eLogCritical, "Identity: Crypto key type ", (int)type, " is not supported");
 		}
 	}
 
diff --git a/libi2pd/LeaseSet.cpp b/libi2pd/LeaseSet.cpp
index c47f23d8..675f6503 100644
--- a/libi2pd/LeaseSet.cpp
+++ b/libi2pd/LeaseSet.cpp
@@ -76,7 +76,7 @@ namespace data
 		LogPrint (eLogDebug, "LeaseSet: Read num=", (int)num);
 		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;
 			return;
 		}
diff --git a/libi2pd/Log.cpp b/libi2pd/Log.cpp
index dfb507c9..76e85d4a 100644
--- a/libi2pd/Log.cpp
+++ b/libi2pd/Log.cpp
@@ -127,13 +127,13 @@ namespace log {
 	void Log::SetLogLevel (const std::string& level_) {
 		std::string level=str_tolower(level_);
 		if      (level == "none")     { m_MinLevel = eLogNone; }
-		else if (level == "critical") { m_MinLevel = eLogCritical}
+		else if (level == "critical") { m_MinLevel = eLogCritical; }
 		else if (level == "error")    { m_MinLevel = eLogError; }
 		else if (level == "warn")     { m_MinLevel = eLogWarning; }
 		else if (level == "info")     { m_MinLevel = eLogInfo; }
 		else if (level == "debug")    { m_MinLevel = eLogDebug; }
 		else {
-			LogPrint(eLogError, "Log: Unknown loglevel: ", level);
+			LogPrint(eLogCritical, "Log: Unknown loglevel: ", level);
 			return;
 		}
 		LogPrint(eLogInfo, "Log: Logging level set to ", level);
@@ -216,7 +216,7 @@ namespace log {
 			m_LogStream = os;
 			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) {
diff --git a/libi2pd/NTCP2.cpp b/libi2pd/NTCP2.cpp
index 48c905ca..91bc9b3d 100644
--- a/libi2pd/NTCP2.cpp
+++ b/libi2pd/NTCP2.cpp
@@ -1242,7 +1242,7 @@ namespace transport
 				boost::system::error_code e;
 				auto itr = m_Resolver.resolve(q, e);
 				if(e)
-					LogPrint(eLogError, "NTCP2: Failed to resolve proxy ", e.message());
+					LogPrint(eLogCritical, "NTCP2: Failed to resolve proxy ", e.message());
 				else
 				{
 					m_ProxyEndpoint.reset (new boost::asio::ip::tcp::endpoint(*itr));
@@ -1270,7 +1270,7 @@ namespace transport
 						}
 						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 ());
 							continue;
 						}
@@ -1313,7 +1313,7 @@ namespace transport
 						}
 						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 ());
 							continue;
 						}
diff --git a/libi2pd/Reseed.cpp b/libi2pd/Reseed.cpp
index dfc10043..28e4db24 100644
--- a/libi2pd/Reseed.cpp
+++ b/libi2pd/Reseed.cpp
@@ -153,7 +153,7 @@ namespace data
 			return ProcessSU3Stream (s);
 		else
 		{
-			LogPrint (eLogError, "Reseed: Can't open file ", filename);
+			LogPrint (eLogCritical, "Reseed: Can't open file ", filename);
 			return 0;
 		}
 	}
@@ -170,7 +170,7 @@ namespace data
 		}
 		else
 		{
-			LogPrint (eLogError, "Reseed: Can't open file ", filename);
+			LogPrint (eLogCritical, "Reseed: Can't open file ", filename);
 			return 0;
 		}
 	}
@@ -278,7 +278,7 @@ namespace data
 
 		if (verify) // not verified
 		{
-			LogPrint (eLogError, "Reseed: SU3 verification failed");
+			LogPrint (eLogCritical, "Reseed: SU3 verification failed");
 			return 0;
 		}
 
@@ -492,7 +492,7 @@ namespace data
 			SSL_free (ssl);
 		}
 		else
-			LogPrint (eLogError, "Reseed: Can't open certificate file ", filename);
+			LogPrint (eLogCritical, "Reseed: Can't open certificate file ", filename);
 		SSL_CTX_free (ctx);
 	}
 
@@ -534,17 +534,17 @@ namespace data
 				}
 				// check for valid proxy url schema
 				if (proxyUrl.schema != "http" && proxyUrl.schema != "socks") {
-					LogPrint(eLogError, "Reseed: Bad proxy url: ", proxy);
+					LogPrint(eLogCritical, "Reseed: Bad proxy url: ", proxy);
 					return "";
 				}
 			} else {
-				LogPrint(eLogError, "Reseed: Bad proxy url: ", proxy);
+				LogPrint(eLogCritical, "Reseed: Bad proxy url: ", proxy);
 				return "";
 			}
 		}
 		i2p::http::URL url;
 		if (!url.parse(address)) {
-			LogPrint(eLogError, "Reseed: Failed to parse url: ", address);
+			LogPrint(eLogCritical, "Reseed: Failed to parse url: ", address);
 			return "";
 		}
 		url.schema = "https";
diff --git a/libi2pd/SSU2.cpp b/libi2pd/SSU2.cpp
index b50284a6..5df4d33a 100644
--- a/libi2pd/SSU2.cpp
+++ b/libi2pd/SSU2.cpp
@@ -99,7 +99,7 @@ namespace transport
 						}
 					}
 					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)
@@ -224,7 +224,7 @@ namespace transport
 		}
 		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 ());
 		}
 		return socket;
diff --git a/libi2pd/SSU2Session.cpp b/libi2pd/SSU2Session.cpp
index c618d136..47d59ea4 100644
--- a/libi2pd/SSU2Session.cpp
+++ b/libi2pd/SSU2Session.cpp
@@ -84,7 +84,7 @@ namespace transport
 		m_Server (server), m_Address (addr), m_RemoteTransports (0),
 		m_DestConnID (0), m_SourceConnID (0), m_State (eSSU2SessionStateUnknown),
 		m_SendPacketNum (0), m_ReceivePacketNum (0), m_LastDatetimeSentPacketNum (0),
-		m_IsDataReceived (false), m_WindowSize (SSU2_MIN_WINDOW_SIZE), 
+		m_IsDataReceived (false), m_WindowSize (SSU2_MIN_WINDOW_SIZE),
 		m_RTT (SSU2_RESEND_INTERVAL), m_RTO (SSU2_RESEND_INTERVAL*SSU2_kAPPA), m_RelayTag (0),
 		m_ConnectTimer (server.GetService ()), m_TerminationReason (eSSU2TerminationReasonNormalClose),
 		m_MaxPayloadSize (SSU2_MIN_PACKET_SIZE - IPV6_HEADER_SIZE - UDP_HEADER_SIZE - 32) // min size
@@ -928,7 +928,7 @@ namespace transport
 		{
 			LogPrint (eLogError, "SSU2: Non zero packet number in SessionConfirmed");
 			return false;
-		}	
+		}
 		// check if fragmented
 		uint8_t numFragments = header.h.flags[0] & 0x0F;
 		if (numFragments > 1)
@@ -1884,7 +1884,7 @@ namespace transport
 		auto r = i2p::data::netdb.FindRouter (GetRemoteIdentity ()->GetIdentHash ()); // Alice's RI
 		if (r && (r->IsUnreachable () || !i2p::data::netdb.PopulateRouterInfoBuffer (r))) r = nullptr;
 		if (!r) LogPrint (eLogWarning, "SSU2: RelayRequest Alice's router info not found");
-		
+
 		uint8_t payload[SSU2_MAX_PACKET_SIZE];
 		size_t payloadSize = r ? CreateRouterInfoBlock (payload, m_MaxPayloadSize - len - 32, r) : 0;
 		if (!payloadSize && r)
@@ -2817,13 +2817,13 @@ namespace transport
 		uint8_t payload[SSU2_MAX_PACKET_SIZE];
 		size_t payloadSize = 0;
 		if (m_SendPacketNum > m_LastDatetimeSentPacketNum + SSU2_SEND_DATETIME_NUM_PACKETS)
-		{	
+		{
 			payload[0] = eSSU2BlkDateTime;
 			htobe16buf (payload + 1, 4);
 			htobe32buf (payload + 3, (i2p::util::GetMillisecondsSinceEpoch () + 500)/1000);
 			payloadSize += 7;
 			m_LastDatetimeSentPacketNum = m_SendPacketNum;
-		}	
+		}
 		payloadSize += CreateAckBlock (payload + payloadSize, m_MaxPayloadSize - payloadSize);
 		payloadSize += CreatePaddingBlock (payload + payloadSize, m_MaxPayloadSize - payloadSize);
 		SendData (payload, payloadSize);
diff --git a/libi2pd/Transports.cpp b/libi2pd/Transports.cpp
index 4e97bb26..c2aeb964 100644
--- a/libi2pd/Transports.cpp
+++ b/libi2pd/Transports.cpp
@@ -200,10 +200,10 @@ namespace transport
 							i2p::context.SetStatusV6 (eRouterStatusProxy);
 					}
 					else
-						LogPrint(eLogError, "Transports: Unsupported NTCP2 proxy URL ", ntcp2proxy);
+						LogPrint(eLogCritical, "Transports: Unsupported NTCP2 proxy URL ", ntcp2proxy);
 				}
 				else
-					LogPrint(eLogError, "Transports: Invalid NTCP2 proxy URL ", ntcp2proxy);
+					LogPrint(eLogCritical, "Transports: Invalid NTCP2 proxy URL ", ntcp2proxy);
 			}
 			else
 				m_NTCP2Server = new NTCP2Server ();
@@ -225,10 +225,10 @@ namespace transport
 							i2p::context.SetStatusV6 (eRouterStatusProxy);
 					}
 					else
-						LogPrint(eLogError, "Transports: Can't set SSU2 proxy ", ssu2proxy);
+						LogPrint(eLogCritical, "Transports: Can't set SSU2 proxy ", ssu2proxy);
 				}
 				else
-					LogPrint(eLogError, "Transports: Invalid SSU2 proxy URL ", ssu2proxy);
+					LogPrint(eLogCritical, "Transports: Invalid SSU2 proxy URL ", ssu2proxy);
 			}
 		}
 
diff --git a/libi2pd_client/AddressBook.cpp b/libi2pd_client/AddressBook.cpp
index 652dfb8d..055311a9 100644
--- a/libi2pd_client/AddressBook.cpp
+++ b/libi2pd_client/AddressBook.cpp
@@ -661,7 +661,7 @@ namespace client
 				this, std::placeholders::_1));
 		}
 		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 ()
diff --git a/libi2pd_client/ClientContext.cpp b/libi2pd_client/ClientContext.cpp
index 41bd1d49..b90386db 100644
--- a/libi2pd_client/ClientContext.cpp
+++ b/libi2pd_client/ClientContext.cpp
@@ -74,7 +74,7 @@ namespace client
 			}
 			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 ());
 			}
 		}
@@ -92,7 +92,7 @@ namespace client
 			}
 			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 ());
 			}
 		}
@@ -112,7 +112,7 @@ namespace client
 			}
 			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 ());
 			}
 		}
@@ -279,7 +279,7 @@ namespace client
 			s.read ((char *)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;
 			}
 			else
@@ -288,7 +288,7 @@ namespace client
 		}
 		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);
 			std::ofstream f (fullPath, std::ofstream::binary | std::ofstream::out);
 			size_t len = keys.GetFullLen ();
@@ -633,7 +633,7 @@ namespace client
 								ins.first->second->Start ();
 							}
 							ins.first->second->isUpdated = true;
-							LogPrint(eLogError, "Clients: I2P Client forward for endpoint ", end, " already exists");
+							LogPrint(eLogCritical, "Clients: I2P Client forward for endpoint ", end, " already exists");
 						}
 
 					} else {
@@ -785,7 +785,7 @@ namespace client
 						else
 						{
 							ins.first->second->isUpdated = true;
-							LogPrint(eLogError, "Clients: I2P Server Forward for destination/port ", m_AddressBook.ToAddress(localDestination->GetIdentHash()), "/", port, " already exists");
+							LogPrint(eLogCritical, "Clients: I2P Server Forward for destination/port ", m_AddressBook.ToAddress(localDestination->GetIdentHash()), "/", port, " already exists");
 						}
 
 						continue;
@@ -851,7 +851,7 @@ namespace client
 			}
 			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 ());
 			}
 		}
@@ -883,7 +883,7 @@ namespace client
 					if (localDestination) localDestination->Acquire ();
 				}
 				else
-					LogPrint(eLogError, "Clients: Failed to load HTTP Proxy key");
+					LogPrint(eLogCritical, "Clients: Failed to load HTTP Proxy key");
 			}
 			try
 			{
@@ -892,7 +892,7 @@ namespace client
 			}
 			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 ());
 			}
 		}
@@ -930,7 +930,7 @@ namespace client
 					if (localDestination) localDestination->Acquire ();
 				}
 				else
-					LogPrint(eLogError, "Clients: Failed to load SOCKS Proxy key");
+					LogPrint(eLogCritical, "Clients: Failed to load SOCKS Proxy key");
 			}
 			try
 			{
@@ -940,7 +940,7 @@ namespace client
 			}
 			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 ());
 			}
 		}
diff --git a/libi2pd_client/SAM.cpp b/libi2pd_client/SAM.cpp
index 4e19990a..37577fcc 100644
--- a/libi2pd_client/SAM.cpp
+++ b/libi2pd_client/SAM.cpp
@@ -1283,7 +1283,7 @@ namespace client
 		}
 		catch (const std::exception& ex)
 		{
-			LogPrint (eLogError, "SAM: Runtime exception: ", ex.what ());
+			LogPrint (eLogCritical, "SAM: Runtime exception: ", ex.what ());
 		}
 
 		{

From e36d5634e7f7ac7e36e4ef9d5297d43c5dca290b Mon Sep 17 00:00:00 2001
From: weko <weko@i2pmail.org>
Date: Fri, 31 Mar 2023 11:40:07 +0000
Subject: [PATCH 3/6] fix log level show in webconsole

---
 daemon/HTTPServer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp
index 8b034332..edfa80df 100644
--- a/daemon/HTTPServer.cpp
+++ b/daemon/HTTPServer.cpp
@@ -749,7 +749,7 @@ namespace http {
 		auto loglevel = i2p::log::Logger().GetLogLevel();
 		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 == eLogCritical ? " selected" : "") << "\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_LOGLEVEL << "&level=critical&token=" << token << "\"> none </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 == eLogError    ? " selected" : "") << "\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_LOGLEVEL << "&level=error&token=" << token << "\"> error </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 == eLogInfo     ? " selected" : "") << "\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_LOGLEVEL << "&level=info&token=" << token << "\"> info </a> \r\n";

From 710a35993db02644f7f28dbee739fe1e7a68a5a5 Mon Sep 17 00:00:00 2001
From: weko <weko@i2pmail.org>
Date: Fri, 31 Mar 2023 12:16:32 +0000
Subject: [PATCH 4/6] change some log level to error back

---
 daemon/Daemon.cpp                |  2 +-
 daemon/HTTPServer.cpp            |  2 +-
 daemon/I2PControl.cpp            |  2 +-
 daemon/UPnP.cpp                  |  2 +-
 daemon/UnixDaemon.cpp            | 16 ++++++++--------
 libi2pd/Blinding.cpp             |  4 ++--
 libi2pd/Destination.cpp          | 12 ++++++------
 libi2pd/Family.cpp               | 10 +++++-----
 libi2pd/Identity.cpp             |  2 +-
 libi2pd_client/ClientContext.cpp |  4 ++--
 10 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/daemon/Daemon.cpp b/daemon/Daemon.cpp
index 02aee72d..8e9721db 100644
--- a/daemon/Daemon.cpp
+++ b/daemon/Daemon.cpp
@@ -262,7 +262,7 @@ namespace util
 				restricted = idents.size() > 0;
 			}
 			if(!restricted)
-				LogPrint(eLogCritical, "Daemon: No trusted routers of families specified");
+				LogPrint(eLogError, "Daemon: No trusted routers of families specified");
 		}
 
 		bool hidden; i2p::config::GetOption("trust.hidden", hidden);
diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp
index edfa80df..dceee06a 100644
--- a/daemon/HTTPServer.cpp
+++ b/daemon/HTTPServer.cpp
@@ -1482,7 +1482,7 @@ namespace http {
 			}
 			catch (std::exception& ex)
 			{
-				LogPrint (eLogCritical, "HTTPServer: Runtime exception: ", ex.what ());
+				LogPrint (eLogError, "HTTPServer: Runtime exception: ", ex.what ());
 			}
 		}
 	}
diff --git a/daemon/I2PControl.cpp b/daemon/I2PControl.cpp
index 354c19d4..da2443fd 100644
--- a/daemon/I2PControl.cpp
+++ b/daemon/I2PControl.cpp
@@ -115,7 +115,7 @@ namespace client
 			try {
 				m_Service.run ();
 			} catch (std::exception& ex) {
-				LogPrint (eLogCritical, "I2PControl: Runtime exception: ", ex.what ());
+				LogPrint (eLogError, "I2PControl: Runtime exception: ", ex.what ());
 			}
 		}
 	}
diff --git a/daemon/UPnP.cpp b/daemon/UPnP.cpp
index 2c915024..dbaf864a 100644
--- a/daemon/UPnP.cpp
+++ b/daemon/UPnP.cpp
@@ -72,7 +72,7 @@ namespace transport
 			}
 			catch (std::exception& ex)
 			{
-				LogPrint (eLogCritical, "UPnP: Runtime exception: ", ex.what ());
+				LogPrint (eLogError, "UPnP: Runtime exception: ", ex.what ());
 				PortMapping ();
 			}
 		}
diff --git a/daemon/UnixDaemon.cpp b/daemon/UnixDaemon.cpp
index 3c17fd14..bf4a7662 100644
--- a/daemon/UnixDaemon.cpp
+++ b/daemon/UnixDaemon.cpp
@@ -81,7 +81,7 @@ namespace i2p
 
 				if (pid < 0) // error
 				{
-					LogPrint(eLogCritical, "Daemon: Could not fork: ", strerror(errno));
+					LogPrint(eLogError, "Daemon: Could not fork: ", strerror(errno));
 					std::cerr << "i2pd: Could not fork: " << strerror(errno) << std::endl;
 					return false;
 				}
@@ -91,7 +91,7 @@ namespace i2p
 				int sid = setsid();
 				if (sid < 0)
 				{
-					LogPrint(eLogCritical, "Daemon: Could not create process group.");
+					LogPrint(eLogError, "Daemon: Could not create process group.");
 					std::cerr << "i2pd: Could not create process group." << std::endl;
 					return false;
 				}
@@ -121,10 +121,10 @@ namespace i2p
 					LogPrint(eLogInfo, "Daemon: Set max number of open files to ",
 						nfiles, " (system limit is ", limit.rlim_max, ")");
 				} else {
-					LogPrint(eLogCritical, "Daemon: Can't set max number of open files: ", strerror(errno));
+					LogPrint(eLogError, "Daemon: Can't set max number of open files: ", strerror(errno));
 				}
 			} else {
-				LogPrint(eLogCritical, "Daemon: limits.openfiles exceeds system limit: ", limit.rlim_max);
+				LogPrint(eLogError, "Daemon: limits.openfiles exceeds system limit: ", limit.rlim_max);
 			}
 			uint32_t cfsize; i2p::config::GetOption("limits.coresize", cfsize);
 			if (cfsize) // core file size set
@@ -134,14 +134,14 @@ namespace i2p
 				if (cfsize <= limit.rlim_max) {
 					limit.rlim_cur = cfsize;
 					if (setrlimit(RLIMIT_CORE, &limit) != 0) {
-						LogPrint(eLogCritical, "Daemon: Can't set max size of coredump: ", strerror(errno));
+						LogPrint(eLogError, "Daemon: Can't set max size of coredump: ", strerror(errno));
 					} else if (cfsize == 0) {
 						LogPrint(eLogInfo, "Daemon: coredumps disabled");
 					} else {
 						LogPrint(eLogInfo, "Daemon: Set max size of core files to ", cfsize / 1024, "Kb");
 					}
 				} else {
-					LogPrint(eLogCritical, "Daemon: limits.coresize exceeds system limit: ", limit.rlim_max);
+					LogPrint(eLogError, "Daemon: limits.coresize exceeds system limit: ", limit.rlim_max);
 				}
 			}
 
@@ -155,7 +155,7 @@ namespace i2p
 				pidFH = open(pidfile.c_str(), O_RDWR | O_CREAT, 0600);
 				if (pidFH < 0)
 				{
-					LogPrint(eLogCritical, "Daemon: Could not create pid file ", pidfile, ": ", strerror(errno));
+					LogPrint(eLogError, "Daemon: Could not create pid file ", pidfile, ": ", strerror(errno));
 					std::cerr << "i2pd: Could not create pid file " << pidfile << ": " << strerror(errno) << std::endl;
 					return false;
 				}
@@ -163,7 +163,7 @@ namespace i2p
 #ifndef ANDROID
 				if (lockf(pidFH, F_TLOCK, 0) != 0)
 				{
-					LogPrint(eLogCritical, "Daemon: Could not lock pid file ", pidfile, ": ", strerror(errno));
+					LogPrint(eLogError, "Daemon: Could not lock pid file ", pidfile, ": ", strerror(errno));
 					std::cerr << "i2pd: Could not lock pid file " << pidfile << ": " << strerror(errno) << std::endl;
 					return false;
 				}
diff --git a/libi2pd/Blinding.cpp b/libi2pd/Blinding.cpp
index 1f15cf14..ced086e1 100644
--- a/libi2pd/Blinding.cpp
+++ b/libi2pd/Blinding.cpp
@@ -259,7 +259,7 @@ namespace data
 				publicKeyLength = i2p::crypto::EDDSA25519_PUBLIC_KEY_LENGTH;
 			break;
 			default:
-				LogPrint (eLogCritical, "Blinding: Can't blind signature type ", (int)m_SigType);
+				LogPrint (eLogError, "Blinding: Can't blind signature type ", (int)m_SigType);
 		}
 		return publicKeyLength;
 	}
@@ -289,7 +289,7 @@ namespace data
 				break;
 			}
 			default:
-				LogPrint (eLogCritical, "Blinding: Can't blind signature type ", (int)m_SigType);
+				LogPrint (eLogError, "Blinding: Can't blind signature type ", (int)m_SigType);
 		}
 		return publicKeyLength;
 	}
diff --git a/libi2pd/Destination.cpp b/libi2pd/Destination.cpp
index 0be25512..4175f54c 100644
--- a/libi2pd/Destination.cpp
+++ b/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)
 							m_AuthType = authType;
 						else
-							LogPrint (eLogCritical, "Destination: Unknown auth type ", authType);
+							LogPrint (eLogCritical, "Destination: Unknown auth type: ", authType);
 					}
 				}
 				it = params->find (I2CP_PARAM_LEASESET_PRIV_KEY);
@@ -117,7 +117,7 @@ namespace client
 					m_LeaseSetPrivKey.reset (new i2p::data::Tag<32>());
 					if (m_LeaseSetPrivKey->FromBase64 (it->second) != 32)
 					{
-						LogPrint(eLogCritical, "Destination: Invalid value i2cp.leaseSetPrivKey ", it->second);
+						LogPrint(eLogCritical, "Destination: Invalid value i2cp.leaseSetPrivKey: ", it->second);
 						m_LeaseSetPrivKey.reset (nullptr);
 					}
 				}
@@ -125,7 +125,7 @@ namespace client
 		}
 		catch (std::exception & ex)
 		{
-			LogPrint(eLogCritical, "Destination: Unable to parse parameters for destination: ", ex.what());
+			LogPrint(eLogError, "Destination: Unable to parse parameters for destination: ", ex.what());
 		}
 		SetNumTags (numTags);
 		m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (inLen, outLen, inQty, outQty, inVar, outVar);
@@ -1014,12 +1014,12 @@ namespace client
 						else if (authType == i2p::data::ENCRYPTED_LEASESET_AUTH_TYPE_PSK)
 							ReadAuthKey (I2CP_PARAM_LEASESET_CLIENT_PSK, params);
 						else
-							LogPrint (eLogCritical, "Destination: Unexpected auth type ", authType);
+							LogPrint (eLogCritical, "Destination: Unexpected auth type: ", authType);
 						if (m_AuthKeys->size ())
 							LogPrint (eLogInfo, "Destination: ", m_AuthKeys->size (), " auth keys read");
 						else
 						{
-							LogPrint (eLogCritical, "Destination: No auth keys read for auth type ", authType);
+							LogPrint (eLogCritical, "Destination: No auth keys read for auth type: ", authType);
 							m_AuthKeys = nullptr;
 						}
 					}
@@ -1413,7 +1413,7 @@ namespace client
 				if (pubKey.FromBase64 (it.second.substr (pos+1)))
 					m_AuthKeys->push_back (pubKey);
 				else
-					LogPrint (eLogCritical, "Destination: Unexpected auth key ", it.second.substr (pos+1));
+					LogPrint (eLogCritical, "Destination: Unexpected auth key: ", it.second.substr (pos+1));
 			}
 		}
 	}
diff --git a/libi2pd/Family.cpp b/libi2pd/Family.cpp
index bca9e231..6564901e 100644
--- a/libi2pd/Family.cpp
+++ b/libi2pd/Family.cpp
@@ -77,14 +77,14 @@ namespace data
 									verifier->SetPublicKey (signingKey);
 								}
 								else
-									LogPrint (eLogCritical, "Family: elliptic curve ", curve, " is not supported");
+									LogPrint (eLogError, "Family: elliptic curve ", curve, " is not supported");
 							}
 							EC_KEY_free (ecKey);
 						}
 						break;
 					}
 					default:
-						LogPrint (eLogCritical, "Family: Certificate key type ", keyType, " is not supported");
+						LogPrint (eLogError, "Family: Certificate key type ", keyType, " is not supported");
 				}
 				EVP_PKEY_free (pkey);
 				if (verifier && cn)
@@ -93,7 +93,7 @@ namespace data
 			SSL_free (ssl);
 		}
 		else
-			LogPrint (eLogCritical, "Family: Can't open certificate file ", filename);
+			LogPrint (eLogError, "Family: Can't open certificate file ", filename);
 		SSL_CTX_free (ctx);
 	}
 
@@ -185,13 +185,13 @@ namespace data
 						delete[] b64;
 					}
 					else
-						LogPrint (eLogCritical, "Family: elliptic curve ", curve, " is not supported");
+						LogPrint (eLogError, "Family: elliptic curve ", curve, " is not supported");
 				}
 			}
 			SSL_free (ssl);
 		}
 		else
-			LogPrint (eLogCritical, "Family: Can't open keys file: ", filename);
+			LogPrint (eLogError, "Family: Can't open keys file: ", filename);
 		SSL_CTX_free (ctx);
 		return sig;
 	}
diff --git a/libi2pd/Identity.cpp b/libi2pd/Identity.cpp
index 7a73f02a..ca47e797 100644
--- a/libi2pd/Identity.cpp
+++ b/libi2pd/Identity.cpp
@@ -755,7 +755,7 @@ namespace data
 				i2p::crypto::CreateECIESX25519AEADRatchetRandomKeys (priv, pub);
 			break;
 			default:
-				LogPrint (eLogCritical, "Identity: Crypto key type ", (int)type, " is not supported");
+				LogPrint (eLogError, "Identity: Crypto key type ", (int)type, " is not supported");
 		}
 	}
 
diff --git a/libi2pd_client/ClientContext.cpp b/libi2pd_client/ClientContext.cpp
index b90386db..dadb9ae5 100644
--- a/libi2pd_client/ClientContext.cpp
+++ b/libi2pd_client/ClientContext.cpp
@@ -633,7 +633,7 @@ namespace client
 								ins.first->second->Start ();
 							}
 							ins.first->second->isUpdated = true;
-							LogPrint(eLogCritical, "Clients: I2P Client forward for endpoint ", end, " already exists");
+							LogPrint(eLogError, "Clients: I2P Client forward for endpoint ", end, " already exists");
 						}
 
 					} else {
@@ -785,7 +785,7 @@ namespace client
 						else
 						{
 							ins.first->second->isUpdated = true;
-							LogPrint(eLogCritical, "Clients: I2P Server Forward for destination/port ", m_AddressBook.ToAddress(localDestination->GetIdentHash()), "/", port, " already exists");
+							LogPrint(eLogError, "Clients: I2P Server Forward for destination/port ", m_AddressBook.ToAddress(localDestination->GetIdentHash()), "/", port, " already exists");
 						}
 
 						continue;

From 2abc997af8785229450cee88dbf594c37afb7da3 Mon Sep 17 00:00:00 2001
From: weko <weko@i2pmail.org>
Date: Fri, 31 Mar 2023 12:29:13 +0000
Subject: [PATCH 5/6] change some log levels back

---
 libi2pd/Family.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libi2pd/Family.cpp b/libi2pd/Family.cpp
index 6564901e..8c6d3ba4 100644
--- a/libi2pd/Family.cpp
+++ b/libi2pd/Family.cpp
@@ -77,14 +77,14 @@ namespace data
 									verifier->SetPublicKey (signingKey);
 								}
 								else
-									LogPrint (eLogError, "Family: elliptic curve ", curve, " is not supported");
+									LogPrint (eLogWarning, "Family: elliptic curve ", curve, " is not supported");
 							}
 							EC_KEY_free (ecKey);
 						}
 						break;
 					}
 					default:
-						LogPrint (eLogError, "Family: Certificate key type ", keyType, " is not supported");
+						LogPrint (eLogWarning, "Family: Certificate key type ", keyType, " is not supported");
 				}
 				EVP_PKEY_free (pkey);
 				if (verifier && cn)
@@ -105,7 +105,7 @@ namespace data
 		int numCertificates = 0;
 
 		if (!i2p::fs::ReadDir(certDir, files)) {
-			LogPrint(eLogError, "Family: Can't load family certificates from ", certDir);
+			LogPrint(eLogWarning, "Family: Can't load family certificates from ", certDir);
 			return;
 		}
 
@@ -185,7 +185,7 @@ namespace data
 						delete[] b64;
 					}
 					else
-						LogPrint (eLogError, "Family: elliptic curve ", curve, " is not supported");
+						LogPrint (eLogWarning, "Family: elliptic curve ", curve, " is not supported");
 				}
 			}
 			SSL_free (ssl);

From a3bdc4ddc1142b60da03e6f01d2a7766e96312dc Mon Sep 17 00:00:00 2001
From: weko <weko@i2pmail.org>
Date: Fri, 31 Mar 2023 12:40:38 +0000
Subject: [PATCH 6/6] change some log levels back

---
 libi2pd/Destination.cpp | 4 ++--
 libi2pd_client/SAM.cpp  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libi2pd/Destination.cpp b/libi2pd/Destination.cpp
index 4175f54c..8002e6f9 100644
--- a/libi2pd/Destination.cpp
+++ b/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)
 							m_AuthType = authType;
 						else
-							LogPrint (eLogCritical, "Destination: Unknown auth type: ", authType);
+							LogPrint (eLogError, "Destination: Unknown auth type: ", authType);
 					}
 				}
 				it = params->find (I2CP_PARAM_LEASESET_PRIV_KEY);
@@ -1014,7 +1014,7 @@ namespace client
 						else if (authType == i2p::data::ENCRYPTED_LEASESET_AUTH_TYPE_PSK)
 							ReadAuthKey (I2CP_PARAM_LEASESET_CLIENT_PSK, params);
 						else
-							LogPrint (eLogCritical, "Destination: Unexpected auth type: ", authType);
+							LogPrint (eLogError, "Destination: Unexpected auth type: ", authType);
 						if (m_AuthKeys->size ())
 							LogPrint (eLogInfo, "Destination: ", m_AuthKeys->size (), " auth keys read");
 						else
diff --git a/libi2pd_client/SAM.cpp b/libi2pd_client/SAM.cpp
index 37577fcc..4e19990a 100644
--- a/libi2pd_client/SAM.cpp
+++ b/libi2pd_client/SAM.cpp
@@ -1283,7 +1283,7 @@ namespace client
 		}
 		catch (const std::exception& ex)
 		{
-			LogPrint (eLogCritical, "SAM: Runtime exception: ", ex.what ());
+			LogPrint (eLogError, "SAM: Runtime exception: ", ex.what ());
 		}
 
 		{