testcontainers-go icon indicating copy to clipboard operation
testcontainers-go copied to clipboard

chore: honour go toolchain's verbose flag to print out logs

Open mdelapenya opened this issue 1 year ago • 1 comments

  • chore: disable logging if the "-v" flag is not present
  • chore: print ryuk is disabled using the logger

What does this PR do?

This PR checks if the verbose flags (v or -test.v) are present in the current execution, keeping the default logger if it's passed. Else, a NOOP logger will be used for all the downstream calls.

If a container defines its own logger in the container request struct, it will be honored.

Why is it important?

Control the verbosity using standard Go flags

Related issues

  • Closes #1984

mdelapenya avatar Jul 04 '24 16:07 mdelapenya

Deploy Preview for testcontainers-go ready!

Name Link
Latest commit 2d1332834a8c17ea28186afb51602af0618d9212
Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/6688156ce1b79f0008057171
Deploy Preview https://deploy-preview-2624--testcontainers-go.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Jul 04 '24 16:07 netlify[bot]

Since we have this logger abstraction, and we discussed it in the context of tc-java, could we also log out the used tc-go version, to help us with debugging based on user logs?

Indeed. I'll add it to the initial banner:

        2024/07/05 10:58:07 github.com/testcontainers/testcontainers-go - Connected to docker: 
          Server Version: 78+testcontainerscloud (via Testcontainers Desktop 1.15.0)
          API Version: 1.43
          Operating System: Ubuntu 20.04 LTS
          Total Memory: 7407 MB
+          Testcontainers Go version: v0.31.0
          Resolved Docker Host: tcp://127.0.0.1:61939
          Resolved Docker Socket Path: /var/run/docker.sock
          Test SessionID: 8cd3a6626cd58d51a66a9da017b40ba50c7130e74ee889f1a38ea4160e6a6f57
          Test ProcessID: 00327949-4162-4994-b191-746e9b44b300

mdelapenya avatar Jul 05 '24 09:07 mdelapenya