Skip to content

Commit

Permalink
Converted some format based logging to safer streams
Browse files Browse the repository at this point in the history
  • Loading branch information
halfgaar committed Mar 4, 2024
1 parent ef35015 commit 707810c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mainapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ bool MainApp::getFuzzMode() const
void MainApp::setlimits()
{
rlim_t nofile = settings.rlimitNoFile;
logger->logf(LOG_INFO, "Setting rlimit nofile to %ld.", nofile);
logger->log(LOG_INFO) << "Setting rlimit nofile to " << nofile;
struct rlimit v = { nofile, nofile };
if (setrlimit(RLIMIT_NOFILE, &v) < 0)
{
Expand Down
7 changes: 4 additions & 3 deletions subscriptionstore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,8 @@ void SubscriptionStore::saveSessionsAndSubscriptions(const std::string &filePath
const std::chrono::time_point<std::chrono::steady_clock> doneCopying = std::chrono::steady_clock::now();

const std::chrono::milliseconds copyDuration = std::chrono::duration_cast<std::chrono::milliseconds>(doneCopying - start);
logger->logf(LOG_DEBUG, "Collected %zu sessions and %zu subscriptions to save in %ld ms.", sessionPointers.size(), subscriptionCopies.size(), copyDuration.count());
logger->log(LOG_DEBUG) << "Collected " << sessionPointers.size() << " sessions and " << subscriptionCopies.size()
<< " subscriptions to save, in " << copyDuration.count() << " ms.";

SessionsAndSubscriptionsDB db(filePath);
db.openWrite();
Expand All @@ -1502,8 +1503,8 @@ void SubscriptionStore::saveSessionsAndSubscriptions(const std::string &filePath
const std::chrono::time_point<std::chrono::steady_clock> doneSaving = std::chrono::steady_clock::now();

const std::chrono::milliseconds saveDuration = std::chrono::duration_cast<std::chrono::milliseconds>(doneSaving - doneCopying);
logger->logf(LOG_INFO, "Saved %zu sessions and %zu subscriptions to '%s' in %ld ms.",
sessionPointers.size(), subscriptionCopies.size(), filePath.c_str(), saveDuration.count());
logger->log(LOG_INFO) << "Saved " << sessionPointers.size() << " sessions and " << subscriptionCopies.size()
<< " subscriptions to '" << filePath << "', in " << saveDuration.count() << " ms.";
}

void SubscriptionStore::loadSessionsAndSubscriptions(const std::string &filePath)
Expand Down

0 comments on commit 707810c

Please sign in to comment.