Skip to content

Comments

Add constants and log utils#13

Merged
heshanpadmasiri merged 6 commits intoballerina-platform:mainfrom
snelusha:ballerina-runtime
Nov 14, 2025
Merged

Add constants and log utils#13
heshanpadmasiri merged 6 commits intoballerina-platform:mainfrom
snelusha:ballerina-runtime

Conversation

@snelusha
Copy link
Contributor

@snelusha snelusha commented Nov 3, 2025

This pull request introduces new error handling and logging utilities, along with a set of constants for symbol flags. The main changes include adding stack trace support to errors, structured logging for critical failures, and a new constants package for commonly used values. Comprehensive unit tests have also been added to verify the new error handling features.

Error handling and logging enhancements:

  • Added ErrorWithStackTrace type and the DecorateWithStackTrace function in errors.go to support attaching stack traces to errors when the BAL_BACKTRACE environment variable is enabled.
  • Implemented LogBadSad and PrintCrashLog functions in errors.go for structured logging of critical, unexpected errors, including timestamp and severity level.

Constants and symbol flags:

  • Introduced a new constants.go file with commonly used string constants and a set of symbol flag bitmasks, plus a utility function IsFlagOn to check flag values.

Testing improvements:

  • Added errors_test.go with unit tests for stack trace decoration, error formatting, and edge cases for the new error handling utilities.

Refactoring and imports:

  • Updated imports in errors.go to support new error handling and logging features.

Closes #11

Copy link
Member

@heshanpadmasiri heshanpadmasiri left a comment

Choose a reason for hiding this comment

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

LGTM

@heshanpadmasiri heshanpadmasiri merged commit 5b93abc into ballerina-platform:main Nov 14, 2025
2 checks passed
@snelusha snelusha deleted the ballerina-runtime branch December 7, 2025 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate ballerina-runtime

2 participants