Skip to content

feat: WithLogger ContainerCustomizer support#2259

Merged
mdelapenya merged 2 commits intotestcontainers:mainfrom
stevenh:feat/request-logger
Mar 1, 2024
Merged

feat: WithLogger ContainerCustomizer support#2259
mdelapenya merged 2 commits intotestcontainers:mainfrom
stevenh:feat/request-logger

Conversation

@stevenh
Copy link
Copy Markdown
Contributor

@stevenh stevenh commented Feb 21, 2024

What does this PR do?

Add support to use WithLogger as a ContainerCustomizer so that callers have an easy way to configure the logger of a container.

Add tests for WithLogger.

Validate Logger and LoggerOption implement the required interfaces.

Also fix a comment typo and remove an unneeded return.

Why is it important?

Allows users to easily configure container loggers which is useful when using modules e.g. postgres or redis.

How to test this PR

go test -run=^TestWithLogger$

@stevenh stevenh requested a review from a team as a code owner February 21, 2024 22:35
@netlify
Copy link
Copy Markdown

netlify bot commented Feb 21, 2024

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit 57e6177
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/65d880ab9a51c00008c25b5c
😎 Deploy Preview https://deploy-preview-2259--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.

Add support to use WithLogger as a ContainerCustomizer so that callers
have an easy way to configure the logger of a container.

Add tests for WithLogger.

Validate Logger and LoggerOption implement the required interfaces.
@mdelapenya mdelapenya self-assigned this Feb 23, 2024
@mdelapenya mdelapenya added the enhancement New feature or request label Feb 23, 2024
Add a note about WithLogger being used before other functions so it can capture any logging they may generate.

Co-authored-by: Manuel de la Peña <[email protected]>
Copy link
Copy Markdown
Member

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for adding this customisation of the container request!

@mdelapenya mdelapenya merged commit c474bcd into testcontainers:main Mar 1, 2024
mdelapenya added a commit to jespino/testcontainers-go that referenced this pull request Mar 1, 2024
* main:
  chore: bump Go version to 1.21 (testcontainers#2292)
  chore(deps): bump github.com/ClickHouse/clickhouse-go/v2 (testcontainers#2226)
  feat: WithLogger ContainerCustomizer support (testcontainers#2259)
  chore(deps): bump github.com/jackc/pgx/v5 in /modules/cockroachdb (testcontainers#2217)
  Move the file and mounts tests into a test package (testcontainers#2270)
  Fix Dockerfile not located when added to dockerignore (testcontainers#2272)
@stevenh stevenh deleted the feat/request-logger branch March 1, 2024 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants