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

Added option to turn off logger #2366

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

avifenesh
Copy link
Collaborator

@avifenesh avifenesh commented Sep 29, 2024

Added OFF option to logger

@avifenesh avifenesh requested a review from a team as a code owner September 29, 2024 11:15
Signed-off-by: avifenesh <aviarchi1994@gmail.com>
Copy link
Collaborator

@barshaul barshaul left a comment

Choose a reason for hiding this comment

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

question inside

@@ -14,7 +14,8 @@ public enum Level
Warn = 1,
Info = 2,
Debug = 3,
Trace = 4
Trace = 4,
Off = 5,
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I think it's more common to use "Disabled"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the built-in naming of the rust logging library we use, I want to keep it consistent

@@ -28,13 +28,13 @@
public final class Logger {
@Getter
public enum Level {
DISABLED(-2),
Copy link
Collaborator

@barshaul barshaul Sep 29, 2024

Choose a reason for hiding this comment

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

why changing it and not using the existing code? setting disabled with -2 allows you to use if (!(level.getLevel() <= loggerLevel.getLevel())) { in the log function without checking specifically if logger.Off

Copy link
Collaborator Author

@avifenesh avifenesh Sep 29, 2024

Choose a reason for hiding this comment

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

In the log, it was already existing the specific check.
In the other, I don't want to check, and I want it to be consistent over all clients. “Special” implantation for one language are not a thing we do. The disabled in java only was supposed to be blocked when it was created so it is implemented for all clients, as I do now, even if the request to fix is for ts only.
Adding a negative number will bring major changes to all other clients, and I think consistency is better than one less if.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

And about naming, the tracing crate we use, use off so I want to be consistent.

Comment on lines -143 to +141
if (level == Level.DISABLED) {
if (level == Level.OFF) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

see my comment above

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As said, it was already there as you see, but even if not, answered above.

Signed-off-by: avifenesh <aviarchi1994@gmail.com>
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.

2 participants