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

Redirect std::cout to both Debug and stdout #172

Open
aryanbaburajan opened this issue Oct 25, 2022 · 3 comments
Open

Redirect std::cout to both Debug and stdout #172

aryanbaburajan opened this issue Oct 25, 2022 · 3 comments
Labels
feature Adding new features

Comments

@aryanbaburajan
Copy link
Member

Is your feature request related to a problem? Please describe.
As of now, once an instance of Engine has been created, all std::cout and std::cerr logs get forwarded into the Debug class, instead of the default stdout/stderr. Though it's useful, it removes the ability of users to debug log normally, especially in scenarios where the Editor isn't open, or the Debug panel is inaccessible, for example in a released game distribution.

Describe the solution you'd like
Copy std::cout/std::cerr instead of simply forwarding, so that it is forwarded to both stdout/stderr (otherwise, the terminal window), while also being logged in the Debug class.

@aryanbaburajan aryanbaburajan added the feature Adding new features label Oct 25, 2022
@Yeffian
Copy link
Contributor

Yeffian commented Oct 29, 2022

Hey, could I be assigned to this?

@aryanbaburajan
Copy link
Member Author

Due to the one std::streambuf limit per std::ostream, logging has been split into two.
Printing to std::cout and std::cerr outputs to the default stdout (terminal), like normal.
Printing to engine.debug outputs to the Editor's built in Console.

Example usage:

engine.debug.err << "This is an error\n";
engine.debug.log << "This is a log\n";

Styling based on log type yet to be implemented.

@aryanbaburajan
Copy link
Member Author

On second thought this looks possible to me now. I'll give it a try soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adding new features
Projects
None yet
Development

No branches or pull requests

2 participants