From 57e6177b9fbb1266dc0ee8b421fa063634d38d1b Mon Sep 17 00:00:00 2001 From: Steven Hartland Date: Fri, 23 Feb 2024 11:25:29 +0000 Subject: [PATCH] chore: add note about order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- docs/features/common_functional_options.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/features/common_functional_options.md b/docs/features/common_functional_options.md index e278c07ba2..fb701906dc 100644 --- a/docs/features/common_functional_options.md +++ b/docs/features/common_functional_options.md @@ -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