-
Notifications
You must be signed in to change notification settings - Fork 6
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
Support real lazy evaluation of the log message lambda #60
Comments
This is very much a blocking point for us. We would need the ability to send all of our The lambda approach is actually inlined syntactic sugar on 2 basic API building blocks: 1) "should I evaluate this log?" and 2) "here's my log" |
Once that top level API is available, we would benefit even from a new API that doesn't take a string but an Okio Source instead (similar to Java InputStream), so that we could serialize some event classes directly to a json string stored in the ring buffer without creating temporary strings per log. Although thinking about this more, this might not work because you require knowing the log size when allocating an entry in the ring buffer. so, that might be a bad idea, or might need an API that includes the size. |
Some notes with regard to lambdas evaluation:
Maybe we could come up with a solution where you can log either by using a lambda or by passing a string/fields directly to the SDK. This would allow deferred evaluation of logs when needed, while keeping things simpler for cases where you're fine with always evaluating the log and its fields. |
Why is that? Is that because the rule "should this be evaluated" is slow enough that it can't run on main? |
Two potential improvements to the logging interface which currently accepts a
message: () -> String
lambda:inline
in the method but since we use interfaces in between that's currently not possible. We should at least provide an overload that just takes theString
directly for cases where the consumers know there won't be any string interpolation.The text was updated successfully, but these errors were encountered: