Skip to content

Conversation

@aedart
Copy link
Contributor

@aedart aedart commented Feb 5, 2025

PR adds a few console output utilities. Among them are:

  • An output() function, that acts as a wrapper for cmake's message().
  • Predefined ANSI escape sequences, which can be enabled (disabled by default when consuming this package).
  • PSR-3 inspired log levels and functions, which respect cmake's current logging level and message modes.

aedart added 30 commits January 29, 2025 14:26
Also, allow provided code to contain multiple values (list form), due to expected semicolons in code.
This was a HUGE issue to locate - the predefined preset was simply NOT defined, for reasons that escape me. A dump() revealed that despite the include_guard(GLOBAL), the output/ansi was somehow included twice, despite the the guard that should prevent it. This made cmake behave really strange!
Useful for a "quick" test / showcase
This caused the "include" issue where the RSP ANSI PRESET list was no longer available, at the time when ANSI was enabled, because (in this case) the "rsp/output" was first included inside the test(s) files, meaning that sequence variables were only define within that file's scope!
Other output util functions will most likely also benefit from this.
This isn't 100%, but at least the colouring is preserved, and some of the double new lines have been removed. There is still a single double line that I was unable to figure out why it is being added.
Also, reformatted some of the log components.
Macro is now slightly more flexible.
The map should allow developers to customise this in any way they wish.
Also, added output capture logic.
This allows developers to use UTC timestamps, instead of local
This should improve the formatting, slightly... But still isn't what it should be. Damn message() behaves really strange - cmake's "simple markup language" is NOT very well documented.
Need to make a small macro to help forward calls to log(), or the overhead of boilerplate script would be too much...
@aedart aedart added the enhancement New feature or request label Feb 5, 2025
@aedart aedart requested a review from kernelguy February 5, 2025 10:43
@aedart aedart self-assigned this Feb 5, 2025
Copy link
Collaborator

@kernelguy kernelguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps for next update add possibility to control ansi_(en/dis)able via cmake command line option.

Project will now enable or disable ANSI output, depending on the option. Defaults to false.
Now using the newly added RSP_ENABLE_ANSI option.
@aedart aedart merged commit 3eafd7f into main Feb 5, 2025
4 checks passed
@aedart aedart deleted the add-output-utils branch February 5, 2025 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants