Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Output Message Batching / Buffers #39

Open
aaldwell opened this issue May 1, 2018 · 1 comment
Open

Output Message Batching / Buffers #39

aaldwell opened this issue May 1, 2018 · 1 comment

Comments

@aaldwell
Copy link
Contributor

aaldwell commented May 1, 2018

Enhancement / Feature.
1 line macro to output text to a buffer of a batching system.

Ideally we would have three separate buffers, 1 for errors, 1 for events, and one for everything else, i.e. general debugging. Separating out message types allows us to more easily filer and navigate the output. The batching system would collect all of these and then output them at the end of the frame to wherever we want, based of those filters. This way, all text output can easily be switched to or additionally output to a log file, or any other source we desire on the file without editing any of the individual lines feeding the buffers.

Potential Examples:
//usage
ERROR_TEXT("Graphics failed to initialize! value of window handle: ", pWindow);
DEBUG_TEXT("Just checking to see if the code hits this line.");
EVENT_TEXT("Model loaded: ", m_name);

//directing output
TextBatcher.eventBuffer.outputMode = TextBatcher::eOutputModes::Logfile;
TextBatcher.errorBuffer.outputMode = TextBatcher::eOutputModes::Screen;
TextBatcher.debugBuffer.outputMode = TextBatcher::eOutputModes::Console;

This would replace all std::cout text output currently in the engine and eliminate a building tech debt in this area.

@aaldwell
Copy link
Contributor Author

aaldwell commented May 4, 2018

Possible implementation details:

  1. put it in Utils, forward declare to_string functions and all types, in some reflection generated file, include in .cpp implementation
  2. template <typename string, typename...> void Log(A...args);
  3. implement for integral types now, but provide way for user-defined types to be added once reflection is in
    4, example call: for inline comma style:
    ERROR_TEXT("Graphics failed to initialize! value of window handle: ", pWindow, "."); //comma delimiter
  4. user must be allowed to provide custom targets such as pWindow

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants