Skip to content

Commit 32acbf4

Browse files
authored
chore: Migrate to LoggerMessageAttribute (#1697)
1 parent 571c175 commit 32acbf4

4 files changed

Lines changed: 134 additions & 116 deletions

File tree

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project>
33
<PropertyGroup>
44
<PackageId>$(AssemblyName)</PackageId>
5-
<Version>4.12.0</Version>
5+
<Version>4.13.0</Version>
66
<AssemblyVersion>$(Version)</AssemblyVersion>
77
<FileVersion>$(Version)</FileVersion>
88
<Product>Testcontainers</Product>

src/Testcontainers/Clients/DockerApiClient.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace DotNet.Testcontainers.Clients
99
using System.Threading;
1010
using System.Threading.Tasks;
1111
using Docker.DotNet;
12+
using DotNet.Testcontainers;
1213
using DotNet.Testcontainers.Configurations;
1314
using JetBrains.Annotations;
1415
using Microsoft.Extensions.Logging;
@@ -118,7 +119,7 @@ await RuntimeInitialized.WaitAsync(ct)
118119
runtimeInfo.Append(string.Join(Environment.NewLine, labels.Select(label => " " + label)));
119120
}
120121

121-
Logger.LogInformation("{RuntimeInfo}", runtimeInfo);
122+
Logger.DockerRuntimeInfo(runtimeInfo.ToString());
122123
}
123124
catch (Exception e)
124125
{

src/Testcontainers/Containers/TarOutputMemoryStream.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace DotNet.Testcontainers.Containers
55
using System.Text;
66
using System.Threading;
77
using System.Threading.Tasks;
8+
using DotNet.Testcontainers;
89
using DotNet.Testcontainers.Configurations;
910
using ICSharpCode.SharpZipLib.Tar;
1011
using Microsoft.Extensions.Logging;
@@ -73,9 +74,7 @@ public async Task AddAsync(IResourceMapping resourceMapping, CancellationToken c
7374

7475
var fileModeOctal = Convert.ToString(tarEntry.TarHeader.Mode, 8).PadLeft(4, '0');
7576

76-
_logger.LogInformation(
77-
"Add file to tar archive: Content length: {Length} byte(s), Target file: \"{Target}\", UID: {Uid}, GID: {Gid}, Mode: {Mode}",
78-
tarEntry.Size, targetFilePath, tarEntry.TarHeader.UserId, tarEntry.TarHeader.GroupId, fileModeOctal);
77+
_logger.AddFileToTarArchive(tarEntry.Size, targetFilePath, tarEntry.TarHeader.UserId, tarEntry.TarHeader.GroupId, fileModeOctal);
7978

8079
await PutNextEntryAsync(tarEntry, ct)
8180
.ConfigureAwait(false);
@@ -153,9 +152,7 @@ public async Task AddAsync(DirectoryInfo directory, FileInfo file, uint uid, uin
153152

154153
var fileModeOctal = Convert.ToString(tarEntry.TarHeader.Mode, 8).PadLeft(4, '0');
155154

156-
_logger.LogInformation(
157-
"Add file to tar archive: Source file: \"{Source}\", Target file: \"{Target}\", UID: {Uid}, GID: {Gid}, Mode: {Mode}",
158-
tarEntry.Size, targetFilePath, tarEntry.TarHeader.UserId, tarEntry.TarHeader.GroupId, fileModeOctal);
155+
_logger.AddFileToTarArchive(file.FullName, targetFilePath, tarEntry.TarHeader.UserId, tarEntry.TarHeader.GroupId, fileModeOctal);
159156

160157
await PutNextEntryAsync(tarEntry, ct)
161158
.ConfigureAwait(false);

0 commit comments

Comments
 (0)