Skip to content

Conversation

@brgix
Copy link
Member

@brgix brgix commented Aug 12, 2025

In sync with a current Ruby OSlg revision in log message length management/approach.

@brgix brgix self-assigned this Aug 12, 2025
@brgix brgix added the enhancement New feature or request label Aug 12, 2025
try:
txt = str(txt).strip()[:length]
sz = int(sz)
if len(txt) > sz: txt = txt[:sz] + " ..."
Copy link
Member Author

Choose a reason for hiding this comment

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

Revisiting a recent change on managing log message lengths, having tested it with other packages (i.e. OSlg as a dependency).

OSlg shall no longer have a built-in limit to log message lengths. Good option to offer, but not one to bake in. All OSlg log functions (e.g. zero, mismatch) call on log, which itself calls trim:

  • ensures valid log message strings
  • trims final log message length if requested by user
  • if trimming not requested by user, leaves log message as is

Each OSlg log function now has an additional sz parameter, which is None by default (and therefore ignored). Users are free to set sz to e.g. "160" chars.

l4 = 2 # "[]"
self.assertEqual(l1 + l2 + l3 + l4, 231)
self.assertEqual(len(a), l1 + l2 + l3 + l4)
self.assertEqual(oslg.mismatch("x", "String", list, a, FTL, None, 156), None)
Copy link
Member Author

Choose a reason for hiding this comment

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

To request a shortened logged message, users need to activate the last log function parameter, sz (here, "156").

Tested, works, hopefully done. Certainly not keen on re-releasing in the future (unless absolutely necessary, e.g. bug, future Python change). So definitely trying to nail this down ASAP.

Running larger test suites (e.g. parent packages, calling upon OSlg). Will only merge and re-release OSlg once all other test suites pass.

@brgix brgix merged commit a25dea0 into develop Aug 13, 2025
4 checks passed
@brgix brgix deleted the lengths branch August 13, 2025 12:00
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.

2 participants