-
Notifications
You must be signed in to change notification settings - Fork 10
Support real lazy evaluation of the log message lambda #60
Copy link
Copy link
Open
Labels
Description
Two potential improvements to the logging interface which currently accepts a message: () -> String lambda:
- Reduce the number of memory allocations. The way it is today the code will allocate once for the lambda, and then again for the string. The ideal way to solve this would be to use
inlinein the method but since we use interfaces in between that's currently not possible. We should at least provide an overload that just takes theStringdirectly for cases where the consumers know there won't be any string interpolation. - Accepting the lambda can give the idea to consumers that the code would be conditionally executed based on the matcher rules. Since we put every log in the ring buffer we should at least add documentation around the expectations on the execution of this lambda. The only times the lambda wouldn't be executed is if the SDK is not initialized.
Reactions are currently unavailable