Skip to content

feat(logging): name the failing method in @logged(), report unmatched responses - #34

Merged
Mikhus merged 1 commit into
masterfrom
logging
Aug 20, 2026
Merged

feat(logging): name the failing method in @logged(), report unmatched responses#34
Mikhus merged 1 commit into
masterfrom
logging

Conversation

@creomobile

@creomobile creomobile commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Two diagnostics changes, both written through the configured logger.

@logged() now writes Class.method() failed, code <code> instead of dumping the caught error. Two methods failing with the same error used to produce two indistinguishable dumps, and a dump could carry personal data, or the call arguments an imq error keeps in its properties. The code is allow-listed only — an IMQ_-prefixed framework code, a system E… code, a small integer, a known Redis reply code or one of a few known Redis-client failure messages mapped to codes of our own; everything else, the error's class name included, becomes unknown. The method name now also reaches the line under standard (TC39) decorators, where it was previously unavailable, and a static method reports its real class instead of Function. Everything else is unchanged: which logger is resolved, doNotThrow, the re-thrown value, and the fact that a throwing logger replaces the original error.

IMQClient now warns about every response which arrives with no pending call left, naming the service, the method and the request id. That tells a late reply apart from a service which never answered, and after a restart it names the backlog the previous process left behind. The response object itself is never logged — it echoes the whole request back, arguments included — and the existing EventEmitter hand-off for such messages is untouched.

No control flow, return value, timeout mechanics or public API changed.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor / internal
  • Other:

Checklist

  • I have read the Contributing guide.
  • Tests added or updated, and the full suite passes locally (npm test).
  • Docs / doc-blocks updated where relevant.
  • The PR is focused on a single logical change.

Contribution terms (required)

  • I have read and agree to the @imqueue Contribution Terms.
    I grant the project owner the right to license my contribution
    commercially, royalty-free, my contribution stays available under
    GPL-3.0, I keep my copyright, and I understand I will receive no fee for
    it. If I did not agree, I would not be submitting this contribution.

- Added logSafe function to safely log messages without throwing errors.
- Introduced errorCode function to extract loggable failure codes from errors.
- Updated IMQClient to log responses with no pending calls.
- Modified @Logged() decorator to log class and method names instead of error objects.
- Added unit tests for logging helpers and response visibility.
@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the @imqueue Contribution Terms. ✅
Posted by the CLA Assistant Lite bot.

@creomobile
creomobile requested a review from Mikhus August 19, 2026 19:10
@creomobile creomobile changed the title feat(logging): enhance logging capabilities and response visibility feat(logging): name the failing method in @logged(), report unmatched responses Aug 19, 2026
@creomobile

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

1 similar comment
@creomobile

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Aug 19, 2026
@Mikhus
Mikhus merged commit 9354485 into master Aug 20, 2026
11 of 23 checks passed
@Mikhus
Mikhus deleted the logging branch August 20, 2026 13:31
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants