Skip to content

Commit

Permalink
chore: add note about order
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stevenh and mdelapenya authored Feb 23, 2024
1 parent 0fed43a commit 57e6177
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/features/common_functional_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ func (g *TestLogConsumer) Accept(l Log) {

If you need to either pass logger to a container, you can use `testcontainers.WithLogger`.

!!!info
Consider calling this before other "With" functions as these may generate logs.

In this example we also use `TestLogger` which writes to the passed in `testing.TB` using `Logf`.
The result is that we capture all logging from the container into the test context meaning its
hidden behind `go test -v` and is associated with the relevant test, providing the user with
Expand Down

0 comments on commit 57e6177

Please sign in to comment.