From adbb8d62d13455ca5730abaf8a2f0c783e6ce673 Mon Sep 17 00:00:00 2001 From: asynts Date: Tue, 12 Jan 2021 14:11:44 +0100 Subject: [PATCH] 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. --- Userland/Libraries/LibTTF/Font.cpp | 2 +- Userland/Libraries/LibVT/Terminal.cpp | 6 +++--- Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp | 12 ++++++------ Userland/Libraries/LibWeb/CSS/StyleResolver.cpp | 4 ++-- Userland/Libraries/LibWeb/DOM/XMLHttpRequest.cpp | 6 +++--- .../LibWeb/HTML/CanvasRenderingContext2D.cpp | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Userland/Libraries/LibTTF/Font.cpp b/Userland/Libraries/LibTTF/Font.cpp index de3ef7a1bfe..e4236c44e9f 100644 --- a/Userland/Libraries/LibTTF/Font.cpp +++ b/Userland/Libraries/LibTTF/Font.cpp @@ -199,7 +199,7 @@ RefPtr Font::load_from_file(const StringView& path, unsigned index) { auto file_or_error = Core::File::open(String(path), Core::IODevice::ReadOnly); if (file_or_error.is_error()) { - dbg() << "Could not open file: " << file_or_error.error(); + dbgln("Could not open file: {}", file_or_error.error()); return nullptr; } auto file = file_or_error.value(); diff --git a/Userland/Libraries/LibVT/Terminal.cpp b/Userland/Libraries/LibVT/Terminal.cpp index ce0ec61d6a3..a5590d32965 100644 --- a/Userland/Libraries/LibVT/Terminal.cpp +++ b/Userland/Libraries/LibVT/Terminal.cpp @@ -893,7 +893,7 @@ void Terminal::on_input(u8 ch) m_parser_state = Normal; return; } else { - dbg() << "Unexpected character in GotEscape '" << (char)ch << "'"; + dbgln("Unexpected character in GotEscape '{}'", (char)ch); m_parser_state = Normal; } return; @@ -919,7 +919,7 @@ void Terminal::on_input(u8 ch) if (ch == '\\') execute_xterm_command(); else - dbg() << "Unexpected string terminator: " << String::format("%02x", ch); + dbgln("Unexpected string terminator: {:#02x}", ch); m_parser_state = Normal; return; case ExpectParameter: @@ -1216,7 +1216,7 @@ void Terminal::execute_hashtag(u8 hashtag) } break; default: - dbg() << "Unknown hashtag: '" << hashtag << "'"; + dbgln("Unknown hashtag: '{}'", (char)hashtag); } } diff --git a/Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp index 62bee3b733a..6f138494a01 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/CSSParser.cpp @@ -34,11 +34,11 @@ #include #include -#define PARSE_ASSERT(x) \ - if (!(x)) { \ - dbg() << "CSS PARSER ASSERTION FAILED: " << #x; \ - dbg() << "At character# " << index << " in CSS: _" << css << "_"; \ - ASSERT_NOT_REACHED(); \ +#define PARSE_ASSERT(x) \ + if (!(x)) { \ + dbgln("CSS PARSER ASSERTION FAILED: {}", #x); \ + dbgln("At character# {} in CSS: _{}_", index, css); \ + ASSERT_NOT_REACHED(); \ } #define PARSE_ERROR() \ @@ -764,7 +764,7 @@ public: auto property_id = CSS::property_id_from_string(property_name); if (property_id == CSS::PropertyID::Invalid) { - dbg() << "CSSParser: Unrecognized property '" << property_name << "'"; + dbgln("CSSParser: Unrecognized property '{}'", property_name); } auto value = parse_css_value(m_context, property_value, property_id); if (!value) diff --git a/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp b/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp index 21715ee92b7..aee19b1c123 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp @@ -492,7 +492,7 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope } return; } - dbg() << "Unsure what to do with CSS margin value '" << value.to_string() << "'"; + dbgln("Unsure what to do with CSS margin value '{}'", value.to_string()); return; } return; @@ -544,7 +544,7 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope } return; } - dbg() << "Unsure what to do with CSS padding value '" << value.to_string() << "'"; + dbgln("Unsure what to do with CSS padding value '{}'", value.to_string()); return; } return; diff --git a/Userland/Libraries/LibWeb/DOM/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/DOM/XMLHttpRequest.cpp index f085ade4fd2..e763a2f3377 100644 --- a/Userland/Libraries/LibWeb/DOM/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/DOM/XMLHttpRequest.cpp @@ -73,13 +73,13 @@ void XMLHttpRequest::open(const String& method, const String& url) void XMLHttpRequest::send() { URL request_url = m_window->document().complete_url(m_url); - dbg() << "XHR send from " << m_window->document().url() << " to " << request_url; + dbgln("XHR send from {} to {}", m_window->document().url(), request_url); // TODO: Add support for preflight requests to support CORS requests Origin request_url_origin = Origin(request_url.protocol(), request_url.host(), request_url.port()); if (!m_window->document().origin().is_same(request_url_origin)) { - dbg() << "XHR failed to load: Same-Origin Policy violation: " << m_window->document().url() << " may not load " << request_url; + dbgln("XHR failed to load: Same-Origin Policy violation: {} may not load {}", m_window->document().url(), request_url); auto weak_this = make_weak_ptr(); if (!weak_this) return; @@ -102,7 +102,7 @@ void XMLHttpRequest::send() [weak_this = make_weak_ptr()](auto& error) { if (!weak_this) return; - dbg() << "XHR failed to load: " << error; + dbgln("XHR failed to load: {}", error); const_cast(*weak_this).set_ready_state(ReadyState::Done); const_cast(*weak_this).dispatch_event(DOM::Event::create(HTML::EventNames::error)); }); diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp index d029e77eb86..3c08f1e73cf 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp +++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp @@ -113,19 +113,19 @@ void CanvasRenderingContext2D::draw_image(const HTMLImageElement& image_element, void CanvasRenderingContext2D::scale(float sx, float sy) { - dbg() << "CanvasRenderingContext2D::scale(): " << sx << ", " << sy; + dbgln("CanvasRenderingContext2D::scale({}, {})", sx, sy); m_transform.scale(sx, sy); } void CanvasRenderingContext2D::translate(float tx, float ty) { - dbg() << "CanvasRenderingContext2D::translate(): " << tx << ", " << ty; + dbgln("CanvasRenderingContext2D::translate({}, {})", tx, ty); m_transform.translate(tx, ty); } void CanvasRenderingContext2D::rotate(float radians) { - dbg() << "CanvasRenderingContext2D::rotate(): " << radians; + dbgln("CanvasRenderingContext2D::rotate({})", radians); m_transform.rotate_radians(radians); }