Logging: finish capitalization fixups

This commit is contained in:
dr|z3d 2021-08-20 03:29:30 +00:00
parent cc1e8e3dcf
commit 789a31e16d
23 changed files with 700 additions and 700 deletions

View file

@ -35,7 +35,7 @@ namespace client
class AddressBookFilesystemStorage: public AddressBookStorage
{
public:
AddressBookFilesystemStorage (): storage("addressbook", "b", "", "b32")
{
i2p::config::GetOption("persist.addressbook", m_IsPersist);
@ -62,7 +62,7 @@ namespace client
private:
i2p::fs::HashedStorage storage;
std::string etagsPath, indexPath, localPath;
std::string etagsPath, indexPath, localPath;
bool m_IsPersist;
std::string m_HostsFile; // file to dump hosts.txt, empty if not used
};
@ -119,7 +119,7 @@ namespace client
std::string path = storage.Path( address->GetIdentHash().ToBase32() );
std::ofstream f (path, std::ofstream::binary | std::ofstream::out);
if (!f.is_open ()) {
LogPrint (eLogError, "Addressbook: can't open file ", path);
LogPrint (eLogError, "Addressbook: Can't open file ", path);
return;
}
size_t len = address->GetFullLen ();
@ -169,7 +169,7 @@ namespace client
LogPrint(eLogWarning, "Addressbook: Can't open ", indexPath);
return 0;
}
LogPrint(eLogInfo, "Addressbook: using index file ", indexPath);
LogPrint(eLogInfo, "Addressbook: Using index file ", indexPath);
LogPrint (eLogInfo, "Addressbook: ", num, " addresses loaded from storage");
return num;
@ -185,9 +185,9 @@ namespace client
int AddressBookFilesystemStorage::Save (const std::map<std::string, std::shared_ptr<Address> >& addresses)
{
if (addresses.empty())
if (addresses.empty())
{
LogPrint(eLogWarning, "Addressbook: not saving empty addressbook");
LogPrint(eLogWarning, "Addressbook: Not saving empty addressbook");
return 0;
}
@ -200,7 +200,7 @@ namespace client
for (const auto& it: addresses)
{
if (it.second->IsValid ())
{
{
f << it.first << ",";
if (it.second->IsIdentHash ())
f << it.second->identHash.ToBase32 ();
@ -208,15 +208,15 @@ namespace client
f << it.second->blindedPublicKey->ToB33 ();
f << std::endl;
num++;
}
}
else
LogPrint (eLogWarning, "Addressbook: invalid address ", it.first);
LogPrint (eLogWarning, "Addressbook: Invalid address ", it.first);
}
LogPrint (eLogInfo, "Addressbook: ", num, " addresses saved");
}
}
else
LogPrint (eLogWarning, "Addressbook: Can't open ", indexPath);
}
}
if (!m_HostsFile.empty ())
{
// dump full hosts.txt
@ -226,18 +226,18 @@ namespace client
for (const auto& it: addresses)
{
std::shared_ptr<const i2p::data::IdentityEx> addr;
if (it.second->IsIdentHash ())
{
if (it.second->IsIdentHash ())
{
addr = GetAddress (it.second->identHash);
if (addr)
f << it.first << "=" << addr->ToBase64 () << std::endl;
}
}
}
}
}
}
else
LogPrint (eLogWarning, "Addressbook: Can't open ", m_HostsFile);
}
}
return num;
}
@ -265,7 +265,7 @@ namespace client
void AddressBookFilesystemStorage::ResetEtags ()
{
LogPrint (eLogError, "Addressbook: resetting eTags");
LogPrint (eLogError, "Addressbook: Resetting eTags");
for (boost::filesystem::directory_iterator it (etagsPath); it != boost::filesystem::directory_iterator (); ++it)
{
if (!boost::filesystem::is_regular_file (it->status ()))
@ -334,17 +334,17 @@ namespace client
}
if (m_IsDownloading)
{
LogPrint (eLogInfo, "Addressbook: subscriptions are downloading, abort");
LogPrint (eLogInfo, "Addressbook: Subscriptions are downloading, abort");
for (int i = 0; i < 30; i++)
{
if (!m_IsDownloading)
{
LogPrint (eLogInfo, "Addressbook: subscriptions download complete");
LogPrint (eLogInfo, "Addressbook: Subscriptions download complete");
break;
}
std::this_thread::sleep_for (std::chrono::seconds (1)); // wait for 1 seconds
}
LogPrint (eLogError, "Addressbook: subscription download timeout");
LogPrint (eLogError, "Addressbook: Subscription download timeout");
m_IsDownloading = false;
}
if (m_Storage)
@ -397,7 +397,7 @@ namespace client
if (pos != std::string::npos)
{
m_Addresses[address] = std::make_shared<Address>(jump.substr (0, pos));
LogPrint (eLogInfo, "Addressbook: added ", address," -> ", jump);
LogPrint (eLogInfo, "Addressbook: Added ", address," -> ", jump);
}
else
{
@ -407,10 +407,10 @@ namespace client
{
m_Storage->AddAddress (ident);
m_Addresses[address] = std::make_shared<Address>(ident->GetIdentHash ());
LogPrint (eLogInfo, "Addressbook: added ", address," -> ", ToAddress(ident->GetIdentHash ()));
LogPrint (eLogInfo, "Addressbook: Added ", address," -> ", ToAddress(ident->GetIdentHash ()));
}
else
LogPrint (eLogError, "Addressbook: malformed address ", jump);
LogPrint (eLogError, "Addressbook: Malformed address ", jump);
}
}
@ -472,7 +472,7 @@ namespace client
auto ident = std::make_shared<i2p::data::IdentityEx> ();
if (!ident->FromBase64(addr)) {
LogPrint (eLogError, "Addressbook: malformed address ", addr, " for ", name);
LogPrint (eLogError, "Addressbook: Malformed address ", addr, " for ", name);
incomplete = f.eof ();
continue;
}
@ -481,12 +481,12 @@ namespace client
if (it != m_Addresses.end ()) // already exists ?
{
if (it->second->IsIdentHash () && it->second->identHash != ident->GetIdentHash () && // address changed?
ident->GetSigningKeyType () != i2p::data::SIGNING_KEY_TYPE_DSA_SHA1) // don't replace by DSA
ident->GetSigningKeyType () != i2p::data::SIGNING_KEY_TYPE_DSA_SHA1) // don't replace by DSA
{
it->second->identHash = ident->GetIdentHash ();
m_Storage->AddAddress (ident);
m_Storage->RemoveAddress (it->second->identHash);
LogPrint (eLogInfo, "Addressbook: updated host: ", name);
LogPrint (eLogInfo, "Addressbook: Updated host: ", name);
}
}
else
@ -494,7 +494,7 @@ namespace client
m_Addresses.emplace (name, std::make_shared<Address>(ident->GetIdentHash ()));
m_Storage->AddAddress (ident);
if (is_update)
LogPrint (eLogInfo, "Addressbook: added new host: ", name);
LogPrint (eLogInfo, "Addressbook: Added new host: ", name);
}
}
else
@ -523,7 +523,7 @@ namespace client
if (s.empty () || s[0] == '#') continue; // skip empty line or comment
m_Subscriptions.push_back (std::make_shared<AddressBookSubscription> (*this, s));
}
LogPrint (eLogInfo, "Addressbook: ", m_Subscriptions.size (), " subscriptions urls loaded");
LogPrint (eLogInfo, "Addressbook: ", m_Subscriptions.size (), " subscriptions URLs loaded");
LogPrint (eLogWarning, "Addressbook: subscriptions.txt usage is deprecated, use config file instead");
}
else if (!i2p::config::IsDefault("addressbook.subscriptions"))
@ -538,11 +538,11 @@ namespace client
if (s.empty () || s[0] == '#') continue; // skip empty line or comment
m_Subscriptions.push_back (std::make_shared<AddressBookSubscription> (*this, s));
}
LogPrint (eLogInfo, "Addressbook: ", m_Subscriptions.size (), " subscriptions urls loaded");
LogPrint (eLogInfo, "Addressbook: ", m_Subscriptions.size (), " subscriptions URLs loaded");
}
}
else
LogPrint (eLogError, "Addressbook: subscriptions already loaded");
LogPrint (eLogError, "Addressbook: Subscriptions already loaded");
}
void AddressBook::LoadLocal ()
@ -627,7 +627,7 @@ namespace client
this, std::placeholders::_1));
}
else
LogPrint (eLogError, "Addressbook: can't start subscriptions: missing shared local destination");
LogPrint (eLogError, "Addressbook: Can't start subscriptions: missing shared local destination");
}
void AddressBook::StopSubscriptions ()
@ -642,7 +642,7 @@ namespace client
{
auto dest = i2p::client::context.GetSharedLocalDestination ();
if (!dest) {
LogPrint(eLogWarning, "Addressbook: missing local destination, skip subscription update");
LogPrint(eLogWarning, "Addressbook: Missing local destination, skip subscription update");
return;
}
if (!m_IsDownloading && dest->IsReady ())
@ -788,7 +788,7 @@ namespace client
LogPrint (eLogInfo, "Addressbook: Downloading hosts database from ", m_Link);
if (!url.parse(m_Link))
{
LogPrint(eLogError, "Addressbook: failed to parse url: ", m_Link);
LogPrint(eLogError, "Addressbook: Failed to parse URL: ", m_Link);
return false;
}
auto addr = m_Book.GetAddress (url.host);
@ -827,7 +827,7 @@ namespace client
}
if (m_Etag.empty() && m_LastModified.empty()) {
m_Book.GetEtag (m_Ident, m_Etag, m_LastModified);
LogPrint (eLogDebug, "Addressbook: loaded for ", url.host, ": ETag: ", m_Etag, ", Last-Modified: ", m_LastModified);
LogPrint (eLogDebug, "Addressbook: Loaded for ", url.host, ": ETag: ", m_Etag, ", Last-Modified: ", m_LastModified);
}
/* save url parts for later use */
std::string dest_host = url.host;
@ -872,7 +872,7 @@ namespace client
// wait 1 more second
if (newDataReceived.wait_for (l, std::chrono::seconds (SUBSCRIPTION_REQUEST_TIMEOUT + 1)) == std::cv_status::timeout)
{
LogPrint (eLogError, "Addressbook: subscriptions request timeout expired");
LogPrint (eLogError, "Addressbook: Subscriptions request timeout expired");
numAttempts++;
if (numAttempts > 5) end = true;
}
@ -885,35 +885,35 @@ namespace client
int res_head_len = res.parse(response);
if (res_head_len < 0)
{
LogPrint(eLogError, "Addressbook: can't parse http response from ", dest_host);
LogPrint(eLogError, "Addressbook: Can't parse HTTP response from ", dest_host);
return false;
}
if (res_head_len == 0)
{
LogPrint(eLogError, "Addressbook: incomplete http response from ", dest_host, ", interrupted by timeout");
LogPrint(eLogError, "Addressbook: Incomplete HTTP response from ", dest_host, ", interrupted by timeout");
return false;
}
/* assert: res_head_len > 0 */
response.erase(0, res_head_len);
if (res.code == 304)
{
LogPrint (eLogInfo, "Addressbook: no updates from ", dest_host, ", code 304");
LogPrint (eLogInfo, "Addressbook: No updates from ", dest_host, ", code 304");
return false;
}
if (res.code != 200)
{
LogPrint (eLogWarning, "Adressbook: can't get updates from ", dest_host, ", response code ", res.code);
LogPrint (eLogWarning, "Adressbook: Can't get updates from ", dest_host, ", response code ", res.code);
return false;
}
int len = res.content_length();
if (response.empty())
{
LogPrint(eLogError, "Addressbook: empty response from ", dest_host, ", expected ", len, " bytes");
LogPrint(eLogError, "Addressbook: Empty response from ", dest_host, ", expected ", len, " bytes");
return false;
}
if (!res.is_gzipped () && len > 0 && len != (int) response.length())
{
LogPrint(eLogError, "Addressbook: response size mismatch, expected: ", len, ", got: ", response.length(), "bytes");
LogPrint(eLogError, "Addressbook: Response size mismatch, expected: ", len, ", got: ", response.length(), "bytes");
return false;
}
/* assert: res.code == 200 */
@ -934,13 +934,13 @@ namespace client
inflator.Inflate ((const uint8_t *) response.data(), response.length(), out);
if (out.fail())
{
LogPrint(eLogError, "Addressbook: can't gunzip http response");
LogPrint(eLogError, "Addressbook: Can't gunzip http response");
return false;
}
response = out.str();
}
std::stringstream ss(response);
LogPrint (eLogInfo, "Addressbook: got update from ", dest_host);
LogPrint (eLogInfo, "Addressbook: Got update from ", dest_host);
m_Book.LoadHostsFromStream (ss, true);
return true;
}