diff --git a/docs/logs/complex-objects/FoodRecallNotice.cs b/docs/logs/complex-objects/FoodRecallNotice.cs index b04c01d7780..40ca59e3b8d 100644 --- a/docs/logs/complex-objects/FoodRecallNotice.cs +++ b/docs/logs/complex-objects/FoodRecallNotice.cs @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -public class FoodRecallNotice +public struct FoodRecallNotice { public string? BrandName { get; set; } diff --git a/docs/logs/complex-objects/Program.cs b/docs/logs/complex-objects/Program.cs index ca6fa891955..c09cfc5c772 100644 --- a/docs/logs/complex-objects/Program.cs +++ b/docs/logs/complex-objects/Program.cs @@ -34,5 +34,5 @@ internal static partial class LoggerExtensions [LoggerMessage(LogLevel.Critical)] public static partial void FoodRecallNotice( this ILogger logger, - [LogProperties(OmitReferenceName = true)] FoodRecallNotice foodRecallNotice); + [LogProperties(OmitReferenceName = true)] in FoodRecallNotice foodRecallNotice); } diff --git a/docs/logs/complex-objects/README.md b/docs/logs/complex-objects/README.md index 7bcc666601a..c784c994879 100644 --- a/docs/logs/complex-objects/README.md +++ b/docs/logs/complex-objects/README.md @@ -30,16 +30,12 @@ dotnet add package Microsoft.Extensions.Telemetry.Abstractions Define a new complex data type, as shown in [FoodRecallNotice.cs](./FoodRecallNotice.cs): ```csharp -public class FoodRecallNotice +public struct FoodRecallNotice { public string? BrandName { get; set; } - public string? ProductDescription { get; set; } - public string? ProductType { get; set; } - public string? RecallReasonDescription { get; set; } - public string? CompanyName { get; set; } } ``` @@ -54,7 +50,7 @@ internal static partial class LoggerExtensions [LoggerMessage(LogLevel.Critical)] public static partial void FoodRecallNotice( this ILogger logger, - [LogProperties(OmitReferenceName = true)] FoodRecallNotice foodRecallNotice); + [LogProperties(OmitReferenceName = true)] in FoodRecallNotice foodRecallNotice); } ``` diff --git a/docs/logs/complex-objects/complex-objects.csproj b/docs/logs/complex-objects/complex-objects.csproj index cb2c93fa1ff..b8b84ddd76a 100644 --- a/docs/logs/complex-objects/complex-objects.csproj +++ b/docs/logs/complex-objects/complex-objects.csproj @@ -1,6 +1,7 @@  true + true