Skip to content

[UI] Add a logger #3

@liubai01

Description

@liubai01

This is a feature request for a basic logger.

Background

  • The framework of the code is in CoreLoggerWidget.cpp
  • The GUI of the editor is based on Dear ImGui.
  • Logger bases on spdlog.
  • Logger helps users debug. The output of other components/widgets should be in the logger.

Goal

image

References and guidance

Show the widget

To show the CoreLoggerWidget.cpp widget, toggle Widget/Logger in menubar.

image

Quick-start

For example, add a line of ImGui::Text("Hello") in CoreLoggerWidget.cpp \ void CoreLoggerWidget::Update().

image

You could then see a line of text in that.

image

Use user-defined sink spdlog as backend

There is a simple example of using spdlog in Debugout.h.

ImGui Front-end example

Dear ImGUI demo shows an example of a log(imgui_demo.cpp/ShowExampleAppLog(...)).

You could uncomment ImGui::ShowDemoWindow(); to show example of widgets of dearImGui in CoreApp.cpp.

void CoreApp::BeforeUpdate()
{
    mGUIManager->Update();
    //ImGui::ShowDemoWindow();
}

A deeper introduction to constructing a widget could refer to this video (in Mandarin Chinese).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions