Skip to content

Commit

Permalink
[docs-logs] Use struct in the complex type logging demo (#5577)
Browse files Browse the repository at this point in the history
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
  • Loading branch information
reyang and cijothomas committed Apr 30, 2024
1 parent dffe70c commit c2558da
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/logs/complex-objects/FoodRecallNotice.cs
Original file line number Diff line number Diff line change
@@ -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; }

Expand Down
2 changes: 1 addition & 1 deletion docs/logs/complex-objects/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
8 changes: 2 additions & 6 deletions docs/logs/complex-objects/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
```
Expand All @@ -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);
}
```

Expand Down
1 change: 1 addition & 0 deletions docs/logs/complex-objects/complex-objects.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Telemetry.Abstractions" />
Expand Down

0 comments on commit c2558da

Please sign in to comment.