1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:57:35 +00:00

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-16 15:51:56 +01:00 committed by Andreas Kling
parent 7dc3a5ce3f
commit 6dc2c38fd0
10 changed files with 105 additions and 112 deletions

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <LibCpp/Lexer.h>
#include <LibGUI/CppSyntaxHighlighter.h>
#include <LibGUI/TextEditor.h>
@ -83,9 +84,7 @@ void CppSyntaxHighlighter::rehighlight(Gfx::Palette palette)
Vector<GUI::TextDocumentSpan> spans;
for (auto& token : tokens) {
#ifdef DEBUG_SYNTAX_HIGHLIGHTING
dbg() << token.to_string() << " @ " << token.m_start.line << ":" << token.m_start.column << " - " << token.m_end.line << ":" << token.m_end.column;
#endif
dbgln<debug_syntax_highlighting>("{} @ {}:{} - {}:{}", token.to_string(), token.m_start.line, token.m_start.column, token.m_end.line, token.m_end.column);
GUI::TextDocumentSpan span;
span.range.set_start({ token.m_start.line, token.m_start.column });
span.range.set_end({ token.m_end.line, token.m_end.column });

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <LibGUI/JSSyntaxHighlighter.h>
#include <LibGUI/TextEditor.h>
#include <LibGfx/Font.h>
@ -107,11 +108,12 @@ void JSSyntaxHighlighter::rehighlight(Gfx::Palette palette)
spans.append(span);
advance_position(str[str.length() - 1]);
#ifdef DEBUG_SYNTAX_HIGHLIGHTING
dbg() << token.name() << (is_trivia ? " (trivia) @ \"" : " @ \"") << token.value() << "\" "
<< span.range.start().line() << ":" << span.range.start().column() << " - "
<< span.range.end().line() << ":" << span.range.end().column();
#endif
dbgln<debug_syntax_highlighting>("{}{} @ '{}' {}:{} - {}:{}",
token.name(),
is_trivia ? " (trivia)" : "",
token.value(),
span.range.start().line(), span.range.start().column(),
span.range.end().line(), span.range.end().column());
};
bool was_eof = false;

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/JsonObject.h>
#include <LibCore/File.h>
#include <LibGUI/JsonArrayModel.h>
@ -34,7 +35,7 @@ void JsonArrayModel::update()
{
auto file = Core::File::construct(m_json_path);
if (!file->open(Core::IODevice::ReadOnly)) {
dbg() << "Unable to open " << file->filename();
dbgln("Unable to open {}", file->filename());
m_array.clear();
did_update();
return;
@ -53,7 +54,7 @@ bool JsonArrayModel::store()
{
auto file = Core::File::construct(m_json_path);
if (!file->open(Core::IODevice::WriteOnly)) {
dbg() << "Unable to open " << file->filename();
dbgln("Unable to open {}", file->filename());
return false;
}

View file

@ -267,3 +267,7 @@ private:
};
}
template<>
struct AK::Formatter<GUI::Window> : Formatter<Core::Object> {
};

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/StringBuilder.h>
#include <LibCore/EventLoop.h>
#include <LibCore/MimeData.h>
@ -43,8 +44,6 @@
#include <LibGfx/Palette.h>
#include <LibGfx/SystemTheme.h>
//#define KEYBOARD_SHORTCUTS_DEBUG
namespace GUI {
WindowServerConnection& WindowServerConnection::the()
@ -142,32 +141,25 @@ void WindowServerConnection::handle(const Messages::WindowClient::KeyDown& messa
auto key_event = make<KeyEvent>(Event::KeyDown, (KeyCode)message.key(), message.modifiers(), message.code_point(), message.scancode());
Action* action = nullptr;
#ifdef KEYBOARD_SHORTCUTS_DEBUG
dbg() << "Looking up action for " << key_event->to_string();
#endif
dbgln<debug_keyboard_shortcuts>("Looking up action for {}", key_event->to_string());
if (auto* focused_widget = window->focused_widget()) {
for (auto* widget = focused_widget; widget && !action; widget = widget->parent_widget()) {
action = widget->action_for_key_event(*key_event);
#ifdef KEYBOARD_SHORTCUTS_DEBUG
dbg() << " > Focused widget " << *widget << " gave action: " << action;
#endif
dbgln<debug_keyboard_shortcuts>(" > Focused widget {} gave action: {}", *widget, action);
}
}
if (!action) {
action = window->action_for_key_event(*key_event);
#ifdef KEYBOARD_SHORTCUTS_DEBUG
dbg() << " > Asked window " << *window << ", got action: " << action;
#endif
dbgln<debug_keyboard_shortcuts>(" > Asked window {}, got action: {}", *window, action);
}
// NOTE: Application-global shortcuts are ignored while a modal window is up.
if (!action && !window->is_modal()) {
action = Application::the()->action_for_key_event(*key_event);
#ifdef KEYBOARD_SHORTCUTS_DEBUG
dbg() << " > Asked application, got action: " << action;
#endif
dbgln<debug_keyboard_shortcuts>(" > Asked application, got action: {}", action);
}
if (action) {