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

Lazy evaluation when logging messages #1960

Merged
merged 5 commits into from
Nov 19, 2018
Merged

Commits on Nov 14, 2018

  1. Lazy evaluation when logging messages

    Formatting variables and then passing them into the logger functions leads
    to performance issues. i.e.
    
    ```erlang
    logger:debug("RECV ~s", [emqx_packet:format(Packet)])
    ```
    
    Above message will only be printed when the current log level set to
    `debug`, but the function emqx_packet:format/1 will always be evaluated no
    matter what the current log level is.
    
    OTP 21 provides a special meta-data named `report_cb`, which can be used
    for lazy evaluation. The fun is only evaluated if the primary/handler log level
    check passes, and is therefore recommended if it is expensive to generate
    the message.
    terry-xiaoyu committed Nov 14, 2018
    Configuration menu
    Copy the full SHA
    c627c6a View commit details
    Browse the repository at this point in the history

Commits on Nov 15, 2018

  1. Configuration menu
    Copy the full SHA
    c95e0fe View commit details
    Browse the repository at this point in the history

Commits on Nov 16, 2018

  1. Change logger micros

    terry-xiaoyu committed Nov 16, 2018
    Configuration menu
    Copy the full SHA
    e41cb5a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9a12434 View commit details
    Browse the repository at this point in the history

Commits on Nov 19, 2018

  1. Configuration menu
    Copy the full SHA
    eefd581 View commit details
    Browse the repository at this point in the history