Fix formatting

Signed-off-by: JCW <a1q123456@users.noreply.github.com>
This commit is contained in:
JCW
2025-09-26 15:46:10 +01:00
parent 6de7802001
commit 17c10de2ea
7 changed files with 126 additions and 204 deletions

View File

@@ -30,8 +30,8 @@
#include <map>
#include <memory>
#include <mutex>
#include <utility>
#include <string_view>
#include <utility>
namespace ripple {
@@ -251,15 +251,15 @@ private:
// Wraps a Journal::Stream to skip evaluation of
// expensive argument lists if the stream is not active.
#ifndef JLOG
#define JLOG_JOIN_(a,b) a##b
#define JLOG_JOIN(a,b) JLOG_JOIN_(a,b)
#define JLOG_UNIQUE(base) JLOG_JOIN(base, __LINE__) // line-based unique name
#define JLOG_JOIN_(a, b) a##b
#define JLOG_JOIN(a, b) JLOG_JOIN_(a, b)
#define JLOG_UNIQUE(base) JLOG_JOIN(base, __LINE__) // line-based unique name
#define JLOG(x) \
#define JLOG(x) \
if (auto JLOG_UNIQUE(stream) = (x); !JLOG_UNIQUE(stream)) \
{ \
} \
else \
{ \
} \
else \
std::move(JLOG_UNIQUE(stream))
#endif

View File

@@ -22,10 +22,10 @@
#include <xrpl/beast/utility/instrumentation.h>
#include <deque>
#include <atomic>
#include <charconv>
#include <cstring>
#include <deque>
#include <mutex>
#include <shared_mutex>
#include <source_location>
@@ -96,10 +96,14 @@ public:
SimpleJsonWriter() = default;
SimpleJsonWriter(SimpleJsonWriter const& other) = default;
SimpleJsonWriter& operator=(SimpleJsonWriter const& other) = default;
SimpleJsonWriter&
operator=(SimpleJsonWriter const& other) = default;
std::string&
buffer() { return *buffer_; }
buffer()
{
return *buffer_;
}
void
startObject() const
@@ -334,16 +338,18 @@ public:
detail::SimpleJsonWriter jsonWriter_;
bool hasMessageParams_ = false;
std::size_t messageOffset_ = 0;
public:
JsonLogContext()
: jsonWriter_(&messageBuffer_)
public:
JsonLogContext() : jsonWriter_(&messageBuffer_)
{
messageBuffer_.reserve(4 * 1024);
}
std::string&
messageBuffer() { return messageBuffer_; }
messageBuffer()
{
return messageBuffer_;
}
void
startMessageParams()
@@ -610,20 +616,20 @@ public:
/** Output stream support. */
/** @{ */
ScopedStream
operator<<(std::ostream& manip(std::ostream&)) const &&
operator<<(std::ostream& manip(std::ostream&)) const&&
{
return {*this, manip};
}
template <typename T>
ScopedStream
operator<<(T const& t) const &&
operator<<(T const& t) const&&
{
return {*this, t};
}
ScopedStream
operator<<(std::ostream& manip(std::ostream&)) const &
operator<<(std::ostream& manip(std::ostream&)) const&
{
currentJsonLogContext_.reuseJson();
return {*this, manip};
@@ -631,7 +637,7 @@ public:
template <typename T>
ScopedStream
operator<<(T const& t) const &
operator<<(T const& t) const&
{
currentJsonLogContext_.reuseJson();
return {*this, t};
@@ -956,7 +962,8 @@ setTextValue(
{
std::ostringstream oss;
oss << value;
writer.buffer() += value;;
writer.buffer() += value;
;
}
writer.buffer() += " ";
}
@@ -1136,7 +1143,8 @@ attributes(Pair&&... pairs)
return [&](beast::detail::SimpleJsonWriter& writer) {
if (beast::Journal::isStructuredJournalEnabled())
{
(detail::setJsonValue(writer, pairs.first, pairs.second, nullptr), ...);
(detail::setJsonValue(writer, pairs.first, pairs.second, nullptr),
...);
}
else
{