Skip to content

Conversation

@Dimitris-Ilias
Copy link
Contributor

@Dimitris-Ilias Dimitris-Ilias commented Nov 20, 2025

https://workable.atlassian.net/browse/PROD-67888

rabbit-queue automatically logs errors using an error logLevel,
but this isn't always desirable by the users of the module

This PR adds basic support for the raiser of the error to be able to specify a boolean logAsWarning attribute for that error, which will make rabbit-queue log a warning instead of an error

@Dimitris-Ilias Dimitris-Ilias changed the title Support custom log level when logging errors Support custom LogLevel when logging errors Nov 20, 2025
handleError(err, msg) {
this.logger.error(err);
const logLevel = err?.logLevel || 'error';
this.logger[logLevel](err);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like that passing something "erroneous" (even a typo) will result to break the whole handling in base handler of a public library.

A validation would suffice or a parameter to switch between error/warning

Copy link
Contributor Author

@Dimitris-Ilias Dimitris-Ilias Nov 24, 2025

Choose a reason for hiding this comment

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

@manoskouvarakis Went with the parameter to switch between error/warning approach.
I used name shouldLogWarning but I'm open to suggestions...
Cytal? cc @DimitrisKalogeropoulos @dktistakis

Copy link
Contributor

Choose a reason for hiding this comment

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

What about logAsWarning ?

Choose a reason for hiding this comment

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

Looks good. Either name would be fine.

Choose a reason for hiding this comment

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

I think logAsWarning best describes what we want to achieve, other than that it's great 👏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@manoskouvarakis @dktistakis @DimitrisKalogeropoulos
I like logAsWarning better too. Done
Also added tests for the new(and the old) functionality

dktistakis
dktistakis previously approved these changes Nov 25, 2025
Comment on lines +14 to +15
ports:
- '5672:5672'
Copy link
Contributor Author

@Dimitris-Ilias Dimitris-Ilias Nov 25, 2025

Choose a reason for hiding this comment

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

This was needed in order for tests to "play" locally

@Dimitris-Ilias Dimitris-Ilias merged commit 5f8fe3f into master Nov 25, 2025
@Dimitris-Ilias Dimitris-Ilias deleted the support_custom_log_level_when_logging_errors branch November 25, 2025 13:47
@Dimitris-Ilias Dimitris-Ilias changed the title Support custom LogLevel when logging errors Support logging errors as warnings Nov 25, 2025
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.

5 participants