Skip to content

Commit 280c721

Browse files
committed
Use thread-safe log writer for seeding.
1 parent 884adf6 commit 280c721

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

PSql.Deploy.Engine/Seeds/ISeedConsole.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ void ReportApplied(ISeedApplication info,
6767
/// <returns>
6868
/// A writer that writes to the log file.
6969
/// </returns>
70+
/// <remarks>
71+
/// Implementations must ensure that the returned writer is thread-safe.
72+
/// </remarks>
7073
/// <exception cref="ArgumentNullException">
7174
/// <paramref name="info"/> is <see langword="null"/>.
7275
/// </exception>

PSql.Deploy/Seeds/CmdletSeedConsole.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ public TextWriter CreateLog(S.ISeedApplication info)
4949

5050
var fileName = $"{target}.{seed}.log".SanitizeFileName();
5151

52-
return new StreamWriter(Path.Combine(_logPath, fileName));
52+
return TextWriter.Synchronized(
53+
new StreamWriter(Path.Combine(_logPath, fileName))
54+
);
5355
}
5456

5557
/// <inheritdoc/>

0 commit comments

Comments
 (0)