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

Shortcut logging when the level isn't active #722

Closed

Commits on Apr 11, 2023

  1. Shortcut logging when the level isn't active

    This commit addresses this issue:
    hashicorp#721
    
    When working with large terraform resource attributes, logging can
    become the primary cost to running plan/apply. This is because the
    context logger used by tfsdklog is very expensive, the SDK framework
    itself is very verbose, and even the log level means Debug/Trace logs
    won't be emitted we still build the log.
    
    As we log via the internal logging package anyway, we can avoid this
    performance issue by maintaining a package-local log-level which is
    initialised at the same time as we init the contextual logger. Then our
    logging package can avoid calling into the tfsdklog (which is where we
    pay the performance penalty) unless it believes the level is active,
    which in most cases avoids 99% of the log cost.
    lawrencejones committed Apr 11, 2023
    Configuration menu
    Copy the full SHA
    a39a43f View commit details
    Browse the repository at this point in the history