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

feat: WithLogger ContainerCustomizer support #2259

Merged
merged 2 commits into from
Mar 1, 2024

Conversation

stevenh
Copy link
Collaborator

@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
Copy link

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.

@stevenh stevenh force-pushed the feat/request-logger branch from 981e63a to 583e43b Compare February 21, 2024 22:41
options.go Outdated Show resolved Hide resolved
logger.go Show resolved Hide resolved
@stevenh stevenh force-pushed the feat/request-logger branch 3 times, most recently from bf019b2 to 97ea5e4 Compare February 22, 2024 13:51
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.
@stevenh stevenh force-pushed the feat/request-logger branch from 97ea5e4 to 0fed43a Compare February 22, 2024 19:12
@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 <social.mdelapenya@gmail.com>
Copy link
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
91 checks passed
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