summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2021-01-11 21:13:30 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-16 11:54:35 +0100
commit01879d27c22a74a8900f570fa3e737f3d3f65fc1 (patch)
treefee4eb042fa58d79f14bf8c43eb2e5cb955c3450 /Userland
parent4953c73fc179449bf17c544845fa888a0a6de926 (diff)
downloadserenity-01879d27c22a74a8900f570fa3e737f3d3f65fc1.zip
Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibGUI/Widget.cpp2
-rw-r--r--Userland/Libraries/LibIPC/ClientConnection.h9
-rw-r--r--Userland/Libraries/LibIPC/Connection.h11
-rw-r--r--Userland/Libraries/LibImageDecoderClient/Client.cpp2
-rw-r--r--Userland/Libraries/LibKeyboard/CharacterMapFile.cpp2
-rw-r--r--Userland/Libraries/LibLine/Editor.cpp4
-rw-r--r--Userland/Libraries/LibRegex/C/Regex.cpp2
-rw-r--r--Userland/Libraries/LibRegex/RegexParser.cpp2
-rw-r--r--Userland/Libraries/LibTLS/ClientHandshake.cpp12
-rw-r--r--Userland/Libraries/LibTLS/Exchange.cpp2
-rw-r--r--Userland/Libraries/LibTLS/Record.cpp6
-rw-r--r--Userland/Libraries/LibTextCodec/Decoder.cpp2
12 files changed, 33 insertions, 23 deletions
diff --git a/Userland/Libraries/LibGUI/Widget.cpp b/Userland/Libraries/LibGUI/Widget.cpp
index 1da1b220e1..89ec37d361 100644
--- a/Userland/Libraries/LibGUI/Widget.cpp
+++ b/Userland/Libraries/LibGUI/Widget.cpp
@@ -992,7 +992,7 @@ bool Widget::load_from_json(const JsonObject& json, RefPtr<Widget> (*unregistere
} else if (class_name.to_string() == "GUI::HorizontalBoxLayout") {
set_layout<GUI::HorizontalBoxLayout>();
} else {
- dbg() << "Unknown layout class: '" << class_name.to_string() << "'";
+ dbgln("Unknown layout class: '{}'", class_name.to_string());
return false;
}
diff --git a/Userland/Libraries/LibIPC/ClientConnection.h b/Userland/Libraries/LibIPC/ClientConnection.h
index a970ebec0e..ea69210557 100644
--- a/Userland/Libraries/LibIPC/ClientConnection.h
+++ b/Userland/Libraries/LibIPC/ClientConnection.h
@@ -54,13 +54,13 @@ public:
void did_misbehave()
{
- dbg() << *this << " (id=" << m_client_id << ", pid=" << client_pid() << ") misbehaved, disconnecting.";
+ dbgln("{} (id={}, pid={}) misbehaved, disconnecting.", *this, m_client_id, client_pid());
this->shutdown();
}
void did_misbehave(const char* message)
{
- dbg() << *this << " (id=" << m_client_id << ", pid=" << client_pid() << ") misbehaved (" << message << "), disconnecting.";
+ dbgln("{} (id={}, pid={}) misbehaved ({}), disconnecting.", *this, m_client_id, client_pid(), message);
this->shutdown();
}
@@ -76,3 +76,8 @@ private:
};
}
+
+template<>
+template<typename ClientEndpoint, typename ServerEndpoint>
+struct AK::Formatter<IPC::ClientConnection<ClientEndpoint, ServerEndpoint>> : Formatter<Core::Object> {
+};
diff --git a/Userland/Libraries/LibIPC/Connection.h b/Userland/Libraries/LibIPC/Connection.h
index 6ceba10ea3..27afd16626 100644
--- a/Userland/Libraries/LibIPC/Connection.h
+++ b/Userland/Libraries/LibIPC/Connection.h
@@ -99,11 +99,11 @@ public:
if (nwritten < 0) {
switch (errno) {
case EPIPE:
- dbg() << *this << "::post_message: Disconnected from peer";
+ dbgln("{}::post_message: Disconnected from peer", *this);
shutdown();
return;
case EAGAIN:
- dbg() << *this << "::post_message: Peer buffer overflowed";
+ dbgln("{}::post_message: Peer buffer overflowed", *this);
shutdown();
return;
default:
@@ -231,7 +231,7 @@ protected:
// in the next run of this function.
auto remaining_bytes = ByteBuffer::copy(bytes.data() + index, bytes.size() - index);
if (!m_unprocessed_bytes.is_empty()) {
- dbg() << *this << "::drain_messages_from_peer: Already have unprocessed bytes";
+ dbgln("{}::drain_messages_from_peer: Already have unprocessed bytes", *this);
shutdown();
return false;
}
@@ -279,3 +279,8 @@ protected:
};
}
+
+template<>
+template<typename LocalEndpoint, typename PeerEndpoint>
+struct AK::Formatter<IPC::Connection<LocalEndpoint, PeerEndpoint>> : Formatter<Core::Object> {
+};
diff --git a/Userland/Libraries/LibImageDecoderClient/Client.cpp b/Userland/Libraries/LibImageDecoderClient/Client.cpp
index cd5fa7243d..0a50afc1b4 100644
--- a/Userland/Libraries/LibImageDecoderClient/Client.cpp
+++ b/Userland/Libraries/LibImageDecoderClient/Client.cpp
@@ -78,7 +78,7 @@ RefPtr<Gfx::Bitmap> Client::decode_image(const ByteBuffer& encoded_data)
auto decoded_buffer = SharedBuffer::create_from_shbuf_id(response->decoded_shbuf_id());
if (!decoded_buffer) {
- dbg() << "Could not map decoded image shbuf_id=" << response->decoded_shbuf_id();
+ dbgln("Could not map decoded image shbuf_id={}", response->decoded_shbuf_id());
return nullptr;
}
diff --git a/Userland/Libraries/LibKeyboard/CharacterMapFile.cpp b/Userland/Libraries/LibKeyboard/CharacterMapFile.cpp
index b6fdc593ed..1417783746 100644
--- a/Userland/Libraries/LibKeyboard/CharacterMapFile.cpp
+++ b/Userland/Libraries/LibKeyboard/CharacterMapFile.cpp
@@ -45,7 +45,7 @@ Optional<CharacterMapData> CharacterMapFile::load_from_file(const String& file_n
auto file = Core::File::construct(path);
file->open(Core::IODevice::ReadOnly);
if (!file->is_open()) {
- dbg() << "Failed to open " << file_name << ":" << file->error_string();
+ dbgln("Failed to open {}: {}", file_name, file->error_string());
return {};
}
diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp
index 22ce831c89..e173259a57 100644
--- a/Userland/Libraries/LibLine/Editor.cpp
+++ b/Userland/Libraries/LibLine/Editor.cpp
@@ -367,7 +367,7 @@ void Editor::register_key_input_callback(const KeyBinding& binding)
if (binding.kind == KeyBinding::Kind::InternalFunction) {
auto internal_function = find_internal_function(binding.binding);
if (!internal_function) {
- dbg() << "LibLine: Unknown internal function '" << binding.binding << "'";
+ dbgln("LibLine: Unknown internal function '{}'", binding.binding);
return;
}
return register_key_input_callback(binding.keys, move(internal_function));
@@ -1644,7 +1644,7 @@ Vector<size_t, 2> Editor::vt_dsr()
// ????
continue;
}
- dbg() << "Error while reading DSR: " << strerror(errno);
+ dbgln("Error while reading DSR: {}", strerror(errno));
m_input_error = Error::ReadFailure;
finish();
return { 1, 1 };
diff --git a/Userland/Libraries/LibRegex/C/Regex.cpp b/Userland/Libraries/LibRegex/C/Regex.cpp
index ad39b18af5..6c468915f0 100644
--- a/Userland/Libraries/LibRegex/C/Regex.cpp
+++ b/Userland/Libraries/LibRegex/C/Regex.cpp
@@ -87,7 +87,7 @@ int regcomp(regex_t* reg, const char* pattern, int cflags)
preg->re_pat_err = (ReError)parser_result.error;
preg->re_pat = pattern;
- dbg() << "Have Error: " << (ReError)parser_result.error;
+ dbgln("Have Error: {}", (int)parser_result.error);
return (ReError)parser_result.error;
}
diff --git a/Userland/Libraries/LibRegex/RegexParser.cpp b/Userland/Libraries/LibRegex/RegexParser.cpp
index 33ade43661..ba82b3f9d8 100644
--- a/Userland/Libraries/LibRegex/RegexParser.cpp
+++ b/Userland/Libraries/LibRegex/RegexParser.cpp
@@ -62,7 +62,7 @@ ALWAYS_INLINE Token Parser::consume(TokenType type, Error error)
{
if (m_parser_state.current_token.type() != type) {
set_error(error);
- dbg() << "[PARSER] Error: Unexpected token " << m_parser_state.current_token.name() << ". Expected: " << Token::name(type);
+ dbgln("[PARSER] Error: Unexpected token {}. Expected: {}", m_parser_state.current_token.name(), Token::name(type));
}
return consume();
}
diff --git a/Userland/Libraries/LibTLS/ClientHandshake.cpp b/Userland/Libraries/LibTLS/ClientHandshake.cpp
index b1fbaa2391..6a5d855a3b 100644
--- a/Userland/Libraries/LibTLS/ClientHandshake.cpp
+++ b/Userland/Libraries/LibTLS/ClientHandshake.cpp
@@ -64,7 +64,7 @@ ssize_t TLSv12::handle_hello(ReadonlyBytes buffer, WritePacketStage& write_packe
size_t following_bytes = buffer[0] * 0x10000 + buffer[1] * 0x100 + buffer[2];
res += 3;
if (buffer.size() - res < following_bytes) {
- dbg() << "not enough data after header: " << buffer.size() - res << " < " << following_bytes;
+ dbgln("not enough data after header: {} < {}", buffer.size() - res, following_bytes);
return (i8)Error::NeedMoreData;
}
@@ -160,13 +160,13 @@ ssize_t TLSv12::handle_hello(ReadonlyBytes buffer, WritePacketStage& write_packe
if (extension_type == HandshakeExtension::ServerName) {
u16 sni_host_length = AK::convert_between_host_and_network_endian(*(const u16*)buffer.offset_pointer(res + 3));
if (buffer.size() - res - 5 < sni_host_length) {
- dbg() << "Not enough data for sni " << (buffer.size() - res - 5) << " < " << sni_host_length;
+ dbgln("Not enough data for sni {} < {}", (buffer.size() - res - 5), sni_host_length);
return (i8)Error::NeedMoreData;
}
if (sni_host_length) {
m_context.SNI = String { (const char*)buffer.offset_pointer(res + 5), sni_host_length };
- dbg() << "server name indicator: " << m_context.SNI;
+ dbgln("server name indicator: {}", m_context.SNI);
}
} else if (extension_type == HandshakeExtension::ApplicationLayerProtocolNegotiation && m_context.alpn.size()) {
if (buffer.size() - res > 2) {
@@ -181,7 +181,7 @@ ssize_t TLSv12::handle_hello(ReadonlyBytes buffer, WritePacketStage& write_packe
String alpn_str { (const char*)alpn + alpn_position, alpn_length };
if (alpn_size && m_context.alpn.contains_slow(alpn_str)) {
m_context.negotiated_alpn = alpn_str;
- dbg() << "negotiated alpn: " << alpn_str;
+ dbgln("negotiated alpn: {}", alpn_str);
break;
}
alpn_position += alpn_length;
@@ -523,7 +523,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer)
}
break;
default:
- dbg() << "message type not understood: " << type;
+ dbgln("message type not understood: {}", type);
return (i8)Error::NotUnderstood;
}
@@ -588,7 +588,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer)
// Ignore this, as it's not an "error"
break;
default:
- dbg() << "Unknown TLS::Error with value " << payload_res;
+ dbgln("Unknown TLS::Error with value {}", payload_res);
ASSERT_NOT_REACHED();
break;
}
diff --git a/Userland/Libraries/LibTLS/Exchange.cpp b/Userland/Libraries/LibTLS/Exchange.cpp
index 0765bc5e9d..de10d568af 100644
--- a/Userland/Libraries/LibTLS/Exchange.cpp
+++ b/Userland/Libraries/LibTLS/Exchange.cpp
@@ -156,7 +156,7 @@ bool TLSv12::compute_master_secret(size_t length)
{
if (m_context.premaster_key.size() == 0 || length < 48) {
dbgln("there's no way I can make a master secret like this");
- dbg() << "I'd like to talk to your manager about this length of " << length;
+ dbgln("I'd like to talk to your manager about this length of {}", length);
return false;
}
diff --git a/Userland/Libraries/LibTLS/Record.cpp b/Userland/Libraries/LibTLS/Record.cpp
index 1f2e875926..c877bd2f21 100644
--- a/Userland/Libraries/LibTLS/Record.cpp
+++ b/Userland/Libraries/LibTLS/Record.cpp
@@ -331,7 +331,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer)
tag);
if (consistency != Crypto::VerificationConsistency::Consistent) {
- dbg() << "integrity check failed (tag length " << tag.size() << ")";
+ dbgln("integrity check failed (tag length {})", tag.size());
auto packet = build_alert(true, (u8)AlertDescription::BadRecordMAC);
write_packet(packet);
@@ -373,7 +373,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer)
auto hmac = hmac_message({ temp_buf, 5 }, decrypted_span.slice(0, length), mac_size);
auto message_mac = ReadonlyBytes { message_hmac, mac_size };
if (hmac != message_mac) {
- dbg() << "integrity check failed (mac length " << mac_size << ")";
+ dbgln("integrity check failed (mac length {})", mac_size);
dbgln("mac received:");
print_buffer(message_mac);
dbgln("mac computed:");
@@ -433,7 +433,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer)
auto level = plain[0];
auto code = plain[1];
if (level == (u8)AlertLevel::Critical) {
- dbg() << "We were alerted of a critical error: " << code << " (" << alert_name((AlertDescription)code) << ")";
+ dbgln("We were alerted of a critical error: {} ({})", code, alert_name((AlertDescription)code));
m_context.critical_error = code;
try_disambiguate_error();
res = (i8)Error::UnknownError;
diff --git a/Userland/Libraries/LibTextCodec/Decoder.cpp b/Userland/Libraries/LibTextCodec/Decoder.cpp
index 6d4f2790f0..8cbc68df01 100644
--- a/Userland/Libraries/LibTextCodec/Decoder.cpp
+++ b/Userland/Libraries/LibTextCodec/Decoder.cpp
@@ -156,7 +156,7 @@ String get_standardized_encoding(const String& encoding)
if (trimmed_lowercase_encoding == "x-user-defined")
return "x-user-defined";
- dbg() << "TextCodec: Unrecognized encoding: " << encoding;
+ dbgln("TextCodec: Unrecognized encoding: {}", encoding);
return {};
}