-
Notifications
You must be signed in to change notification settings - Fork 0
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
Logger feature requests #47
Comments
I'd also love to be able to attach streams to individual loggers. Use case is that I could make a logger for my scripting system and hook up a stream that writes to a "scripting log" output window that wouldn't have all the logging messages from the engine This may or may not be the kind of thing you meant with "log filters". I didn't really get what you meant by that but it seemed important |
The |
The filtering system should allow for filtering out log instances and log levels. |
Oh nice. That'll serve my needs just fine |
So looking at it a bit more I've come to this design: TagsBy changing the constructor around we can support user-defined tags: template<Size E>
Log::Log(const char* _name, const Array<Tag[E]>& _tags); Where struct Tag {
const char* name;
Uint32 fg_color;
Uint32 bg_color = 0; // Optional, zero means don't change bg color
}; What this means in practice is you can define a log with user-defined tags like: Log("name", Array{Tag{"rtag", 0xFF0000}, Tag{"btag", 0x00FF00}, Tag{"gtag", 0x0000FF}}); Which would give you Since RX_LOG(logger, "name", Tag{"rtag", 0xFF0000}, Tag{"gtag", 0x00FF00}, Tag{"btag", 0x0000F}); Which I think looks pretty cool. This does however mean the usual "info", "warning", "error" and "verbose" tags and helper functions will not exist, all logs will have to define all their tags. The logging interface will then be based entirely on which string-literal tag you pass for a given log, so invoking the logger as: logger("rtag", ...); // prints to rtag
logger("gtag", ...); // prints to gtag FilteringWe'll introduce a [[nodiscard]] bool Log::filter(const char* _tag_name);
[[nodiscard]] bool Log::unfilter(const char* _tag_name); Thoughts? |
TagsI generally like your design for user-defined tags. I don't really want to have to define error/warning/info/verbose tags for every logger, though Maybe invoking the log could either take a tag name or a full #define ERROR Tag{"error", 0xFF0000}
logger(ERROR, "Everything broke"); FilteringFiltering based on tag seems reasonable, as long as I can also filter based on logger name |
There's no easy way to provide |
User-configurable colors for the log levels
Logger support for colored log text and background text
Log filters
Runtime-configurable log message queue length
Stream interface able to report support for colors
User-definable tag names
The text was updated successfully, but these errors were encountered: