Skip to content

Support real lazy evaluation of the log message lambda  #60

@murki

Description

@murki

Two potential improvements to the logging interface which currently accepts a message: () -> String lambda:

  1. 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 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 the String directly for cases where the consumers know there won't be any string interpolation.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions