diff --git a/Libraries/LibCore/Object.cpp b/Libraries/LibCore/Object.cpp index cf16b4aadf0..55cd1024097 100644 --- a/Libraries/LibCore/Object.cpp +++ b/Libraries/LibCore/Object.cpp @@ -150,7 +150,7 @@ void Object::custom_event(CustomEvent&) void Object::start_timer(int ms, TimerShouldFireWhenNotVisible fire_when_not_visible) { if (m_timer_id) { - dbgprintf("Object{%p} already has a timer!\n", this); + dbgln("{} {:p} already has a timer!", class_name(), this); ASSERT_NOT_REACHED(); } diff --git a/Libraries/LibGUI/Clipboard.cpp b/Libraries/LibGUI/Clipboard.cpp index 860fdbfee54..ff2873d5433 100644 --- a/Libraries/LibGUI/Clipboard.cpp +++ b/Libraries/LibGUI/Clipboard.cpp @@ -83,11 +83,11 @@ Clipboard::DataAndType Clipboard::data_and_type() const return {}; auto shared_buffer = SharedBuffer::create_from_shbuf_id(response->shbuf_id()); if (!shared_buffer) { - dbgprintf("GUI::Clipboard::data() failed to attach to the shared buffer\n"); + dbgln("GUI::Clipboard::data() failed to attach to the shared buffer"); return {}; } if (response->data_size() > shared_buffer->size()) { - dbgprintf("GUI::Clipboard::data() clipping contents size is greater than shared buffer size\n"); + dbgln("GUI::Clipboard::data() clipping contents size is greater than shared buffer size"); return {}; } auto data = ByteBuffer::copy(shared_buffer->data(), response->data_size()); @@ -100,7 +100,7 @@ void Clipboard::set_data(ReadonlyBytes data, const String& type, const HashMap(); auto result = m_event_loop->exec(); m_event_loop = nullptr; - dbgprintf("%s: event loop returned with result %d\n", class_name(), result); + dbgln("{}: event loop returned with result {}", class_name(), result); remove_from_parent(); s_current_drag_operation = nullptr; return m_outcome; diff --git a/Libraries/LibGUI/InputBox.cpp b/Libraries/LibGUI/InputBox.cpp index 432dfe84c33..8e24da6fa64 100644 --- a/Libraries/LibGUI/InputBox.cpp +++ b/Libraries/LibGUI/InputBox.cpp @@ -96,7 +96,7 @@ void InputBox::build() m_ok_button->set_fixed_height(20); m_ok_button->set_text("OK"); m_ok_button->on_click = [this](auto) { - dbgprintf("GUI::InputBox: OK button clicked\n"); + dbgln("GUI::InputBox: OK button clicked"); m_text_value = m_text_editor->text(); done(ExecOK); }; @@ -105,7 +105,7 @@ void InputBox::build() m_cancel_button->set_fixed_height(20); m_cancel_button->set_text("Cancel"); m_cancel_button->on_click = [this](auto) { - dbgprintf("GUI::InputBox: Cancel button clicked\n"); + dbgln("GUI::InputBox: Cancel button clicked"); done(ExecCancel); }; diff --git a/Libraries/LibGUI/Menu.cpp b/Libraries/LibGUI/Menu.cpp index a32dd38078f..47e284312a3 100644 --- a/Libraries/LibGUI/Menu.cpp +++ b/Libraries/LibGUI/Menu.cpp @@ -72,7 +72,7 @@ void Menu::add_action(NonnullRefPtr action) { m_items.append(make(m_menu_id, move(action))); #ifdef GMENU_DEBUG - dbgprintf("GUI::Menu::add_action(): MenuItem Menu ID: %d\n", m_menu_id); + dbgln("GUI::Menu::add_action(): MenuItem Menu ID: {}", m_menu_id); #endif } @@ -134,7 +134,7 @@ int Menu::realize_menu(RefPtr default_action) m_menu_id = WindowServerConnection::the().send_sync(m_name)->menu_id(); #ifdef MENU_DEBUG - dbgprintf("GUI::Menu::realize_menu(): New menu ID: %d\n", m_menu_id); + dbgln("GUI::Menu::realize_menu(): New menu ID: {}", m_menu_id); #endif ASSERT(m_menu_id > 0); for (size_t i = 0; i < m_items.size(); ++i) { diff --git a/Libraries/LibGUI/Window.cpp b/Libraries/LibGUI/Window.cpp index 353997a224a..62af3d07e1a 100644 --- a/Libraries/LibGUI/Window.cpp +++ b/Libraries/LibGUI/Window.cpp @@ -534,7 +534,7 @@ void Window::update(const Gfx::IntRect& a_rect) for (auto& pending_rect : m_pending_paint_event_rects) { if (pending_rect.contains(a_rect)) { #ifdef UPDATE_COALESCING_DEBUG - dbgprintf("Ignoring %s since it's contained by pending rect %s\n", a_rect.to_string().characters(), pending_rect.to_string().characters()); + dbgln("Ignoring {} since it's contained by pending rect {}", a_rect, pending_rect); #endif return; } diff --git a/Libraries/LibGfx/BitmapFont.cpp b/Libraries/LibGfx/BitmapFont.cpp index 9933a7af4e9..26c596cf002 100644 --- a/Libraries/LibGfx/BitmapFont.cpp +++ b/Libraries/LibGfx/BitmapFont.cpp @@ -129,16 +129,16 @@ RefPtr BitmapFont::load_from_memory(const u8* data) { auto& header = *reinterpret_cast(data); if (memcmp(header.magic, "!Fnt", 4)) { - dbgprintf("header.magic != '!Fnt', instead it's '%c%c%c%c'\n", header.magic[0], header.magic[1], header.magic[2], header.magic[3]); + dbgln("header.magic != '!Fnt', instead it's '{:c}{:c}{:c}{:c}'", header.magic[0], header.magic[1], header.magic[2], header.magic[3]); return nullptr; } if (header.name[sizeof(header.name) - 1] != '\0') { - dbgprintf("Font name not fully null-terminated\n"); + dbgln("Font name not fully null-terminated"); return nullptr; } if (header.family[sizeof(header.family) - 1] != '\0') { - dbgprintf("Font family not fully null-terminated\n"); + dbgln("Font family not fully null-terminated"); return nullptr; } diff --git a/Libraries/LibGfx/PNGLoader.cpp b/Libraries/LibGfx/PNGLoader.cpp index bbb9b441034..687d0231c73 100644 --- a/Libraries/LibGfx/PNGLoader.cpp +++ b/Libraries/LibGfx/PNGLoader.cpp @@ -888,7 +888,7 @@ static bool process_IHDR(ReadonlyBytes data, PNGLoadingContext& context) if (context.interlace_method != PngInterlaceMethod::Null && context.interlace_method != PngInterlaceMethod::Adam7) { #ifdef PNG_DEBUG - dbgprintf("PNGLoader::process_IHDR: unknown interlace method: %d\n", context.interlace_method); + dbgln("PNGLoader::process_IHDR: unknown interlace method: {}", context.interlace_method); #endif return false; } diff --git a/Libraries/LibLine/Editor.cpp b/Libraries/LibLine/Editor.cpp index de298b562c3..1a4a2f997e7 100644 --- a/Libraries/LibLine/Editor.cpp +++ b/Libraries/LibLine/Editor.cpp @@ -736,7 +736,7 @@ void Editor::handle_read_event() case InputState::CSIExpectFinal: { m_state = InputState::Free; if (!(code_point >= 0x40 && code_point <= 0x7f)) { - dbgprintf("LibLine: Invalid CSI: %02x (%c)\r\n", code_point, code_point); + dbgln("LibLine: Invalid CSI: {:02x} ({:c})", code_point, code_point); continue; } csi_final = code_point; @@ -797,10 +797,10 @@ void Editor::handle_read_event() } // ^[[5~: page up // ^[[6~: page down - dbgprintf("LibLine: Unhandled '~': %d\r\n", param1); + dbgln("LibLine: Unhandled '~': {}", param1); continue; default: - dbgprintf("LibLine: Unhandled final: %02x (%c)\r\n", code_point, code_point); + dbgln("LibLine: Unhandled final: {:02x} ({:c})", code_point, code_point); continue; } break; diff --git a/Services/AudioServer/Mixer.cpp b/Services/AudioServer/Mixer.cpp index bff2a099900..66a33ed23dc 100644 --- a/Services/AudioServer/Mixer.cpp +++ b/Services/AudioServer/Mixer.cpp @@ -44,7 +44,7 @@ Mixer::Mixer() "AudioServer[mixer]")) { if (!m_device->open(Core::IODevice::WriteOnly)) { - dbgprintf("Can't open audio device: %s\n", m_device->error_string()); + dbgln("Can't open audio device: {}", m_device->error_string()); return; } diff --git a/Services/SystemServer/Service.cpp b/Services/SystemServer/Service.cpp index d5bd06eba48..99b01b5ab69 100644 --- a/Services/SystemServer/Service.cpp +++ b/Services/SystemServer/Service.cpp @@ -211,7 +211,7 @@ void Service::spawn(int socket_fd) if (m_account.has_value()) { auto& account = m_account.value(); if (setgid(account.gid()) < 0 || setgroups(account.extra_gids().size(), account.extra_gids().data()) < 0 || setuid(account.uid()) < 0) { - dbgprintf("Failed to drop privileges (GID=%u, UID=%u)\n", account.gid(), account.uid()); + dbgln("Failed to drop privileges (GID={}, UID={})\n", account.gid(), account.uid()); exit(1); } setenv("HOME", account.home_directory().characters(), true); diff --git a/Services/Taskbar/TaskbarWindow.cpp b/Services/Taskbar/TaskbarWindow.cpp index a68dedc4c96..fbc79466349 100644 --- a/Services/Taskbar/TaskbarWindow.cpp +++ b/Services/Taskbar/TaskbarWindow.cpp @@ -233,7 +233,7 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event) case GUI::Event::WM_WindowRemoved: { #ifdef EVENT_DEBUG auto& removed_event = static_cast(event); - dbgprintf("WM_WindowRemoved: client_id=%d, window_id=%d\n", + dbgln("WM_WindowRemoved: client_id={}, window_id={}", removed_event.client_id(), removed_event.window_id()); #endif @@ -246,10 +246,10 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event) case GUI::Event::WM_WindowRectChanged: { #ifdef EVENT_DEBUG auto& changed_event = static_cast(event); - dbgprintf("WM_WindowRectChanged: client_id=%d, window_id=%d, rect=%s\n", + dbgln("WM_WindowRectChanged: client_id={}, window_id={}, rect={}", changed_event.client_id(), changed_event.window_id(), - changed_event.rect().to_string().characters()); + changed_event.rect()); #endif break; } @@ -257,7 +257,7 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event) case GUI::Event::WM_WindowIconBitmapChanged: { auto& changed_event = static_cast(event); #ifdef EVENT_DEBUG - dbgprintf("WM_WindowIconBitmapChanged: client_id=%d, window_id=%d, icon_buffer_id=%d\n", + dbgln("WM_WindowIconBitmapChanged: client_id={}, window_id={}, icon_buffer_id={}", changed_event.client_id(), changed_event.window_id(), changed_event.icon_buffer_id()); @@ -274,11 +274,11 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event) case GUI::Event::WM_WindowStateChanged: { auto& changed_event = static_cast(event); #ifdef EVENT_DEBUG - dbgprintf("WM_WindowStateChanged: client_id=%d, window_id=%d, title=%s, rect=%s, is_active=%u, is_minimized=%u\n", + dbgln("WM_WindowStateChanged: client_id={}, window_id={}, title={}, rect={}, is_active={}, is_minimized={}", changed_event.client_id(), changed_event.window_id(), - changed_event.title().characters(), - changed_event.rect().to_string().characters(), + changed_event.title(), + changed_event.rect(), changed_event.is_active(), changed_event.is_minimized()); #endif diff --git a/Services/WindowServer/EventLoop.cpp b/Services/WindowServer/EventLoop.cpp index 1a38e89b6f6..21dae58823f 100644 --- a/Services/WindowServer/EventLoop.cpp +++ b/Services/WindowServer/EventLoop.cpp @@ -99,7 +99,7 @@ void EventLoop::drain_mouse() for (size_t i = 0; i < npackets; ++i) { auto& packet = packets[i]; #ifdef WSMESSAGELOOP_DEBUG - dbgprintf("EventLoop: Mouse X %d, Y %d, Z %d, relative %d\n", packet.x, packet.y, packet.z, packet.is_relative); + dbgln("EventLoop: Mouse X {}, Y {}, Z {}, relative={}", packet.x, packet.y, packet.z, packet.is_relative); #endif buttons = packet.buttons; @@ -117,7 +117,7 @@ void EventLoop::drain_mouse() if (buttons != state.buttons) { state.buttons = buttons; #ifdef WSMESSAGELOOP_DEBUG - dbgprintf("EventLoop: Mouse Button Event\n"); + dbgln("EventLoop: Mouse Button Event"); #endif screen.on_receive_mouse_data(state); if (state.is_relative) { diff --git a/Services/WindowServer/Screen.cpp b/Services/WindowServer/Screen.cpp index 2d68c4890e3..4cc9ae809b5 100644 --- a/Services/WindowServer/Screen.cpp +++ b/Services/WindowServer/Screen.cpp @@ -134,12 +134,12 @@ void Screen::on_receive_mouse_data(const MousePacket& packet) if (packet.is_relative) { m_cursor_location.move_by(packet.x * m_acceleration_factor, packet.y * m_acceleration_factor); #ifdef WSSCREEN_DEBUG - dbgprintf("Screen: New Relative mouse point @ X %d, Y %d\n", m_cursor_location.x(), m_cursor_location.y()); + dbgln("Screen: New Relative mouse point @ {}", m_cursor_location); #endif } else { m_cursor_location = { packet.x * m_width / 0xffff, packet.y * m_height / 0xffff }; #ifdef WSSCREEN_DEBUG - dbgprintf("Screen: New Absolute mouse point @ X %d, Y %d\n", m_cursor_location.x(), m_cursor_location.y()); + dbgln("Screen: New Absolute mouse point @ {}", m_cursor_location); #endif } diff --git a/Userland/crash.cpp b/Userland/crash.cpp index 8aeae5f69a2..5f4c763a4f0 100644 --- a/Userland/crash.cpp +++ b/Userland/crash.cpp @@ -256,7 +256,7 @@ int main(int argc, char** argv) u8* makeshift_esp = makeshift_stack + 2048; asm volatile("mov %%eax, %%esp" ::"a"(makeshift_esp)); getuid(); - dbgprintf("Survived syscall with MAP_STACK stack\n"); + dbgln("Survived syscall with MAP_STACK stack"); u8* bad_stack = (u8*)mmap(nullptr, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); if (!bad_stack) diff --git a/Userland/pro.cpp b/Userland/pro.cpp index 970352331dc..95f9a74ed0a 100644 --- a/Userland/pro.cpp +++ b/Userland/pro.cpp @@ -288,7 +288,7 @@ int main(int argc, char** argv) auto output_stream = ConditionalOutputFileStream { [&] { return save_at_provided_name ? received_actual_headers : true; }, stdout }; download->stream_into(output_stream); - dbgprintf("started download with id %d\n", download->id()); + dbgln("started download with id {}", download->id()); auto rc = loop.exec(); // FIXME: This shouldn't be needed.