1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-08-13 12:27:48 +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-15 21:29:01 +01:00 committed by Andreas Kling
parent 7b0a1a98d9
commit 27bc48e06c
11 changed files with 116 additions and 109 deletions

View file

@ -28,6 +28,7 @@
#include "JSIntegration.h"
#include "Workbook.h"
#include <AK/ByteBuffer.h>
#include <AK/Debug.h>
#include <AK/GenericLexer.h>
#include <AK/JsonArray.h>
#include <AK/JsonObject.h>
@ -354,9 +355,7 @@ void Sheet::copy_cells(Vector<Position> from, Vector<Position> to, Optional<Posi
auto& target = to.first();
for (auto& position : from) {
#ifdef COPY_DEBUG
dbg() << "Paste from '" << position.to_url() << "' to '" << target.to_url() << "'";
#endif
dbgln<debug_copy>("Paste from '{}' to '{}'", position.to_url(), target.to_url());
copy_to(position, resolve_relative_to.has_value() ? offset_relative_to(target, position, resolve_relative_to.value()) : target);
}
@ -367,9 +366,7 @@ void Sheet::copy_cells(Vector<Position> from, Vector<Position> to, Optional<Posi
// Fill the target selection with the single cell.
auto& source = from.first();
for (auto& position : to) {
#ifdef COPY_DEBUG
dbg() << "Paste from '" << source.to_url() << "' to '" << position.to_url() << "'";
#endif
dbgln<debug_copy>("Paste from '{}' to '{}'", source.to_url(), position.to_url());
copy_to(source, resolve_relative_to.has_value() ? offset_relative_to(position, source, resolve_relative_to.value()) : position);
}
return;

View file

@ -28,11 +28,10 @@
#include "FormEditorWidget.h"
#include "FormWidget.h"
#include "WidgetTreeModel.h"
#include <AK/Debug.h>
#include <AK/LogStream.h>
#include <LibGfx/Palette.h>
//#define DEBUG_CURSOR_TOOL
namespace HackStudio {
void CursorTool::on_mousedown(GUI::MouseEvent& event)
@ -49,9 +48,7 @@ void CursorTool::on_mousedown(GUI::MouseEvent& event)
m_editor.selection().toggle(*result.widget);
} else if (!event.modifiers()) {
if (!m_editor.selection().contains(*result.widget)) {
#ifdef DEBUG_CURSOR_TOOL
dbg() << "Selection didn't contain " << *result.widget << ", making it the only selected one";
#endif
dbgln<debug_cursor_tool>("Selection didn't contain {}, making it the only selected one", *result.widget);
m_editor.selection().set(*result.widget);
}

View file

@ -26,13 +26,11 @@
#include "ClientConnection.h"
#include "AutoComplete.h"
#include <AK/Debug.h>
#include <AK/HashMap.h>
#include <LibCore/File.h>
#include <LibGUI/TextDocument.h>
// #define DEBUG_CPP_LANGUAGE_SERVER
// #define DEBUG_FILE_CONTENT
namespace LanguageServers::Cpp {
static HashMap<int, RefPtr<ClientConnection>> s_connections;
@ -89,9 +87,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileOpened& messag
auto document = GUI::TextDocument::create(&s_default_document_client);
document->set_text(content_view);
m_open_files.set(message.file_name(), document);
#ifdef DEBUG_FILE_CONTENT
dbg() << document->text();
#endif
dbgln<debug_file_content>("{}", document->text());
}
void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText& message)

View file

@ -26,13 +26,11 @@
#include "ClientConnection.h"
#include "AutoComplete.h"
#include <AK/Debug.h>
#include <AK/HashMap.h>
#include <LibCore/File.h>
#include <LibGUI/TextDocument.h>
// #define DEBUG_SH_LANGUAGE_SERVER
// #define DEBUG_FILE_CONTENT
namespace LanguageServers::Shell {
static HashMap<int, RefPtr<ClientConnection>> s_connections;
@ -89,9 +87,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileOpened& messag
auto document = GUI::TextDocument::create(&s_default_document_client);
document->set_text(content_view);
m_open_files.set(message.file_name(), document);
#ifdef DEBUG_FILE_CONTENT
dbg() << document->text();
#endif
dbgln<debug_file_content>("{}", document->text());
}
void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText& message)
@ -133,9 +129,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileEditRemoveText
};
document->remove(range);
#ifdef DEBUG_FILE_CONTENT
dbg() << document->text();
#endif
dbgln<debug_file_content>("{}", document->text());
}
void ClientConnection::handle(const Messages::LanguageServer::AutoCompleteSuggestions& message)

View file

@ -25,14 +25,13 @@
*/
#include <AK/ByteBuffer.h>
#include <AK/Debug.h>
#include <AK/Optional.h>
#include <LibCore/Gzip.h>
#include <LibCore/puff.h>
#include <limits.h>
#include <stddef.h>
//#define DEBUG_GZIP
namespace Core {
bool Gzip::is_compressed(const ByteBuffer& data)
@ -103,9 +102,7 @@ static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data)
}
auto new_size = data.size() - current;
#ifdef DEBUG_GZIP
dbg() << "get_gzip_payload: Returning slice from " << current << " with size " << new_size;
#endif
dbgln<debug_gzip>("get_gzip_payload: Returning slice from {} with size {}", current, new_size);
return data.slice(current, new_size);
}
@ -113,9 +110,7 @@ Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data)
{
ASSERT(is_compressed(data));
#ifdef DEBUG_GZIP
dbg() << "Gzip::decompress: Decompressing gzip compressed data. Size = " << data.size();
#endif
dbgln<debug_gzip>("Gzip::decompress: Decompressing gzip compressed data. size={}", data.size());
auto optional_payload = get_gzip_payload(data);
if (!optional_payload.has_value()) {
return Optional<ByteBuffer>();
@ -127,13 +122,13 @@ Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data)
while (true) {
unsigned long destination_len = destination.size();
#ifdef DEBUG_GZIP
dbg() << "Gzip::decompress: Calling puff()\n"
<< " destination_data = " << destination.data() << "\n"
<< " destination_len = " << destination_len << "\n"
<< " source_data = " << source.data() << "\n"
<< " source_len = " << source_len;
#endif
if constexpr (debug_gzip) {
dbgln("Gzip::decompress: Calling puff()");
dbgln(" destination_data = {}", destination.data());
dbgln(" destination_len = {}", destination_len);
dbgln(" source_data = {}", source.data());
dbgln(" source_len = {}", source_len);
}
auto puff_ret = puff(
destination.data(), &destination_len,