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

Allow disabling logging feature #1190

Closed

Commits on Jan 15, 2021

  1. Allow disabling logging feature

    Logging macro `if_log_enabled` checks both `log` and `always-log` crate
    features to select which macro version to use. Unfortunately, `log` feature
    cannot be set by crate consumers in either existing form or if added
    to `Cargo.toml`, probably because of a name clash with `log` crate:
    
    ```diff
    $ git diff Cargo.toml
    diff --git a/tracing/Cargo.toml b/tracing/Cargo.toml
    index 37bb61f..e030d27 100644
    --- a/tracing/Cargo.toml
    +++ b/tracing/Cargo.toml
    @@ -63,7 +63,7 @@ release_max_level_trace = []
     async-await = []
    
     std = ["tracing-core/std"]
    +log = ["log"]
     log-always = ["log"]
     attributes = ["tracing-attributes"]
     ```
    
    ```
    Caused by:
      optional dependency `log` is not included in any feature
      Make sure that `dep:log` is included in one of features in the [features] table.
    ```
    
    I'm renaming `log` feature to `logging` to work around that.
    
    There's a slight improvement in throughput with logging disabled:
    
    ```
    global/collector/span_no_fields
                            time:   [7.9682 ns 7.9704 ns 7.9729 ns]
                            change: [-13.902% -13.812% -13.720%] (p = 0.00 < 0.05)
                            Performance has improved.
    ```
    bobrik committed Jan 15, 2021
    Configuration menu
    Copy the full SHA
    2d54456 View commit details
    Browse the repository at this point in the history

Commits on Jan 27, 2021

  1. Configuration menu
    Copy the full SHA
    479ad38 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    029a523 View commit details
    Browse the repository at this point in the history