Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console and Engine Logger separate implementations #14

Open
SpinnerX opened this issue Aug 6, 2024 · 0 comments
Open

Console and Engine Logger separate implementations #14

SpinnerX opened this issue Aug 6, 2024 · 0 comments

Comments

@SpinnerX
Copy link
Member

SpinnerX commented Aug 6, 2024

Overview

As the time of writing of this issue. Engine3D's logger is only able to be used to supply a spdlog::format_string and writing to the console. It works but we may want to look into how loggers may be defined in Engine3D more carefully.

One of the things that I thought about is what if developers wanted to send logs messages to specifics UI's or if they have multiple terminal consoles and how would this be supplied.

Intention

Disclaimer - This is still able to be changed in the future if this feature's not needed. The API is a quick code snippet of how I may see this newly feature be used.

  • The intention is having a few types of loggers that can be customized to users. Few types being one for writing to console and one writing to the UI.

  • Console Loggers are logger messages that can be written to either console terminal or redirecting logging messages to a specific terminal if needed.

  • Engine Loggers are loggers that can redirect loggers within a UI, Widget, or internal structure of the engine. Which can supply an object to that UI, Panel, Layer, or application redirecting logging messages to the supplied pointer to those objects.

API Idea

Here are how I am considering having an API look for the console and engine-defined logger.

// We'd probably have some abstraction called engine3d::ConsoleEngineLogger
ConsoleLogTrace(console, fmt, args...)

// usage
//! @param console is if users want to define where their loggers write to which console.
ConsoleLogTrace(&console, "There was an error that occured at location {}", dt);

Engine-defined logger

  • Engine-defined loggers can also be used to redirect log messages to specific UI's or other portions of the engine that may be seen fit to the user.
//! @note We'd have a class probably on a separate thread that would handle engine-level loggers
// this loggers intentional use in the UI Editor.
// engine3d::EngineLogger
// Disclaimer - at the time of writing this issue the name is the same as the logger that already exists, because I cant think of a different name at the time of writing this issue.

// API Example 
EngineLogTrace(engine_t, fmt, args...);
EngineLog*(widget/ui/panels, fmt, args...);

// API Usage

EngineLogInfo(&panel[0], "This panel accepts this log and number is {}", 0);
@SpinnerX SpinnerX converted this from a draft issue Aug 6, 2024
@SpinnerX SpinnerX changed the title User and Engine defined logger features Console and Engine Logger separate implementations Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant