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.
This commit is contained in:
asynts 2021-01-11 21:13:30 +01:00 committed by Andreas Kling
parent 4953c73fc1
commit 01879d27c2
Notes: sideshowbarker 2024-07-18 23:11:40 +09:00
12 changed files with 33 additions and 23 deletions

View file

@ -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;
}

View file

@ -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> {
};

View file

@ -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> {
};

View file

@ -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;
}

View file

@ -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 {};
}

View file

@ -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 };

View file

@ -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;
}

View file

@ -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();
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;

View file

@ -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 {};
}