Revert unrelated changes & performance optimisation

Signed-off-by: JCW <a1q123456@users.noreply.github.com>
This commit is contained in:
JCW
2025-09-08 16:40:34 +01:00
parent ce5a6aec7b
commit dcec5a0bbc
13 changed files with 93 additions and 101 deletions

View File

@@ -71,10 +71,10 @@ private:
operator=(Sink const&) = delete;
void
write(beast::severities::Severity level, std::string&& text) override;
write(beast::severities::Severity level, std::string_view text) override;
void
writeAlways(beast::severities::Severity level, std::string&& text)
writeAlways(beast::severities::Severity level, std::string_view text)
override;
};
@@ -205,7 +205,7 @@ public:
write(
beast::severities::Severity level,
std::string const& partition,
std::string const& text,
std::string_view text,
bool console);
std::string
@@ -246,7 +246,7 @@ public:
static void
format(
std::string& output,
std::string const& message,
std::string_view message,
beast::severities::Severity severity,
std::string const& partition);

View File

@@ -366,7 +366,7 @@ private:
severities::Severity severity) const;
static std::string_view
formatLog(std::string&& message);
formatLog(std::string const& message);
public:
//--------------------------------------------------------------------------
@@ -420,7 +420,7 @@ public:
level is below the current threshold().
*/
virtual void
write(Severity level, std::string&& text) = 0;
write(Severity level, std::string_view text) = 0;
/** Bypass filter and write text to the sink at the specified severity.
* Always write the message, but maintain the same formatting as if
@@ -430,7 +430,7 @@ public:
* @param text Text to write to sink.
*/
virtual void
writeAlways(Severity level, std::string&& text) = 0;
writeAlways(Severity level, std::string_view text) = 0;
private:
Severity thresh_;

View File

@@ -88,17 +88,17 @@ public:
}
void
write(beast::severities::Severity level, std::string&& text) override
write(beast::severities::Severity level, std::string_view text) override
{
using beast::Journal;
sink_.write(level, prefix_ + text);
sink_.write(level, prefix_ + std::string{text});
}
void
writeAlways(severities::Severity level, std::string&& text) override
writeAlways(severities::Severity level, std::string_view text) override
{
using beast::Journal;
sink_.writeAlways(level, prefix_ + text);
sink_.writeAlways(level, prefix_ + std::string{text});
}
};

View File

@@ -132,8 +132,7 @@ public:
}
}
JLOG(m_journal.debug())
<< "New inbound endpoint " << log::param("Entry", *entry);
JLOG(m_journal.debug()) << "New inbound endpoint " << *entry;
return Consumer(*this, *entry);
}
@@ -161,8 +160,7 @@ public:
}
}
JLOG(m_journal.debug())
<< "New outbound endpoint " << log::param("Entry", *entry);
JLOG(m_journal.debug()) << "New outbound endpoint " << *entry;
return Consumer(*this, *entry);
}
@@ -195,8 +193,7 @@ public:
}
}
JLOG(m_journal.debug())
<< "New unlimited endpoint " << log::param("Entry", *entry);
JLOG(m_journal.debug()) << "New unlimited endpoint " << *entry;
return Consumer(*this, *entry);
}
@@ -353,8 +350,7 @@ public:
{
if (iter->whenExpires <= elapsed)
{
JLOG(m_journal.debug())
<< "Expired " << log::param("Entry", *iter);
JLOG(m_journal.debug()) << "Expired " << *iter;
auto table_iter = table_.find(*iter->key);
++iter;
erase(table_iter);
@@ -426,9 +422,7 @@ public:
std::lock_guard _(lock_);
if (--entry.refcount == 0)
{
JLOG(m_journal.debug())
<< "Inactive " << log::param("Entry", entry);
;
JLOG(m_journal.debug()) << "Inactive " << entry;
switch (entry.key->kind)
{
@@ -480,8 +474,7 @@ public:
clock_type::time_point const now(m_clock.now());
int const balance(entry.add(fee.cost(), now));
JLOG(getStream(fee.cost(), m_journal))
<< "Charging " << log::param("Entry", entry) << " for "
<< log::param("Fee", fee) << context;
<< "Charging " << entry << " for " << fee << context;
return disposition(balance);
}
@@ -503,9 +496,7 @@ public:
}
if (notify)
{
JLOG(m_journal.info())
<< "Load warning: " << log::param("Entry", entry);
;
JLOG(m_journal.info()) << "Load warning: " << entry;
++m_stats.warn;
}
return notify;
@@ -524,10 +515,8 @@ public:
if (balance >= dropThreshold)
{
JLOG(m_journal.warn())
<< "Consumer entry " << log::param("Entry", entry)
<< " dropped with balance " << log::param("Entry", balance)
<< " at or above drop threshold "
<< log::param("Entry", dropThreshold);
<< "Consumer entry " << entry << " dropped with balance "
<< balance << " at or above drop threshold " << dropThreshold;
// Adding feeDrop at this point keeps the dropped connection
// from re-connecting for at least a little while after it is