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

KLoggingEventBuilder accept nullable values in payload #400

Closed
Zack-Freedman-Thoughtworks opened this issue Feb 24, 2024 · 4 comments
Closed

Comments

@Zack-Freedman-Thoughtworks
Copy link

Zack-Freedman-Thoughtworks commented Feb 24, 2024

Hello! Is it possible to modify KLoggingEventBuilder to accept nullable values? This would allow us to avoid null-checks in the code we are adding logs to.

Example:

logger.atError {
    this.message = "Failed to make a good example: ${throwable.message}."
    this.cause = throwable
    this.payload = mapOf(
        "itemOne" to headers.getNullableThing(),
    )
}
Copy link

Thank you for reporting an issue. See the wiki for documentation and slack for questions.

@oshai
Copy link
Owner

oshai commented Feb 26, 2024

yes. would you like to create a PR?

@Zack-Freedman-Thoughtworks
Copy link
Author

@oshai Created a PR here. Would you please help me validate that it doesn't lead to a null-pointer? I'm not too knowledgable in how this library integrates with the other libraries as a whole.

Sadly as these are public classes, I'm not sure if these are backwards compatible changes. I also happen to know data classes don't fair well with backwards compatible changes either. See here

@oshai
Copy link
Owner

oshai commented Mar 6, 2024

I think the change is safe (both NPE and backward compatibility).

@oshai oshai closed this as completed Apr 14, 2024
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

No branches or pull requests

2 participants