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

Build in log sink functionality. #9

Merged
merged 5 commits into from
Sep 15, 2021
Merged

Build in log sink functionality. #9

merged 5 commits into from
Sep 15, 2021

Commits on Sep 7, 2021

  1. Build in log sink functionality.

    Starting to address #6. This is just the start of the work, but it gives
    us something to build on.
    
    Basically, what we're trying to do is build log sink functionality into
    terraform-plugin-log. Normally, Terraform acts as a log sink, gathering
    up logs from core and from all the plugins, filtering them
    appropriately, and combining them into a single log output stream, and
    deciding where to send that stream. However, when running acceptance
    tests, the plugin is actually the longest-running process, and so this
    model breaks down. Instead, we need to have the plugin act as the sink,
    gathering the logs from core and the plugin and other plugins, combining
    them into a single stream, filtering the stream, and deciding where to
    output the stream.
    
    Rather than implement this functionality multiple times in different
    SDKs, it makes more sense to add it to the tfsdklog package and just
    call it from the test frameworks.
    
    There are a few parts to this. First, we need a new sink logger that all
    other loggers are derived from. It should read environment variables to
    determine what level of output is desired, what format of output is
    desired, and where to send that output. Second, we should make all our
    loggers be sub-loggers of that sink when the sink is set. Third, we
    should make sure our sub-loggers can only log at levels equal to or
    higher than the level of this new sink logger when it's set. And
    finally, we should provide functionality to process hclog JSON output
    (like from terraform when TF_LOG=json) and route it through this sink
    logger, so we can combine the log output of the CLI and other providers
    with the log output native to the process.
    
    This commit falls short in a few places:
    
    * sub-loggers aren't limited to equal-or-higher levels from the sink
      logger yet.
    * none of this has been tested, even manually. It builds?
    * we need to check that all the environment variables we need to be
      honoring are getting honored for the provider under test, the CLI, and
      the providers the CLI launches.
    
    This depends on #10.
    paddycarver committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    fdd4391 View commit details
    Browse the repository at this point in the history
  2. Rebase on top of #10.

    paddycarver committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    a88f1bc View commit details
    Browse the repository at this point in the history
  3. Add changelog entries.

    paddycarver committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    d7f5936 View commit details
    Browse the repository at this point in the history

Commits on Sep 15, 2021

  1. Add env var comments.

    paddycarver committed Sep 15, 2021
    Configuration menu
    Copy the full SHA
    efcf877 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    eeb87e8 View commit details
    Browse the repository at this point in the history