Skip to content

Commit 7786c2f

Browse files
Add trace logs for LogWaitStrategy
1 parent 95e73b6 commit 7786c2f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/wait-strategy.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import byline from "byline";
12
import { Duration, TemporalUnit } from "node-duration";
23
import { BoundPorts } from "./bound-ports";
34
import { Container, HealthCheckStatus } from "./container";
45
import { ContainerState } from "./container-state";
56
import { DockerClient } from "./docker-client";
6-
import { log } from "./logger";
7+
import { log, containerLog } from "./logger";
78
import { Port } from "./port";
89
import { PortCheck } from "./port-check";
910
import { IntervalRetryStrategy } from "./retry-strategy";
@@ -86,20 +87,23 @@ export class LogWaitStrategy extends AbstractWaitStrategy {
8687
const stream = await container.logs();
8788

8889
return new Promise((resolve, reject) => {
89-
stream
90+
byline(stream)
9091
.on("data", (line) => {
92+
containerLog.trace(`Received log line: ${line}`);
9193
if (line.includes(this.message)) {
9294
stream.destroy();
9395
resolve();
9496
}
9597
})
9698
.on("err", (line) => {
99+
containerLog.trace(`Received log line error: ${line}`);
97100
if (line.includes(this.message)) {
98101
stream.destroy();
99102
resolve();
100103
}
101104
})
102105
.on("end", () => {
106+
containerLog.trace(`Log stream closed`);
103107
stream.destroy();
104108
reject();
105109
});

0 commit comments

Comments
 (0)