Skip to content

Commit

Permalink
do not truncate log line
Browse files Browse the repository at this point in the history
  • Loading branch information
tsl0922 committed Jan 5, 2024
1 parent e886893 commit 55fb90a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions source/views/debug.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) 2022-2023 tsl0922. All rights reserved.
// SPDX-License-Identifier: GPL-2.0-only

#include <cstdarg>
#include <cstdio>
#include <map>
#include "helpers/utils.h"
#include "helpers/imgui.h"
Expand Down Expand Up @@ -335,11 +337,18 @@ void Debug::Console::ClearLog() {
}

void Debug::Console::AddLog(const char* level, const char* fmt, ...) {
char buf[1024];
va_list args;
std::va_list args;
va_start(args, fmt);
vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args);
buf[IM_ARRAYSIZE(buf) - 1] = 0;

int size;
std::va_list copy;
va_copy(copy, args);
size = std::vsnprintf(nullptr, 0, fmt, copy);
va_end(copy);

char buf[size + 1];
std::vsnprintf(buf, size, fmt, args);
buf[size] = '\0';
va_end(args);

int fontIdx = 1; // mono
Expand Down

0 comments on commit 55fb90a

Please sign in to comment.