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

Refactor Assert Handler Logging #887

Open
Joshua-Anderson opened this issue Aug 3, 2021 · 1 comment
Open

Refactor Assert Handler Logging #887

Joshua-Anderson opened this issue Aug 3, 2021 · 1 comment

Comments

@Joshua-Anderson
Copy link
Contributor

Right now the assert handler prints to stderr, not the default F' logging class.
It also calls snprintf, which embedded targets may want to avoid

@matt392code
Copy link
Contributor

assert-handler.txt
This solution addresses the key issues by:

  1. Removing snprintf Dependency
void writeDigits(U32 num, LogString& str)
  • Custom number-to-string conversion
  • No standard library dependencies
  • Embedded-system friendly
  1. Using F Prime Logger
Logger::logMsg(log.getData(), log.getSize(), Logger::FATAL);
  • Integrates with F Prime logging system
  • Consistent log handling
  • No stderr usage
  1. Memory Efficiency
  • Static strings for prefixes
  • Efficient buffer usage
  • No dynamic allocation
  1. Configuration Options
namespace AssertConfig {
    static const U32 MAX_STRING_SIZE = 256;
    static const Logger::LogLevel ASSERT_LOG_LEVEL = Logger::FATAL;
}
  • Configurable string sizes
  • Adjustable log levels
  • Compile-time configuration

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

No branches or pull requests

3 participants