File tree 4 files changed +5
-8
lines changed
docs/logs/complex-objects
4 files changed +5
-8
lines changed Original file line number Diff line number Diff line change 1
1
// Copyright The OpenTelemetry Authors
2
2
// SPDX-License-Identifier: Apache-2.0
3
3
4
- public class FoodRecallNotice
4
+ public struct FoodRecallNotice
5
5
{
6
6
public string ? BrandName { get ; set ; }
7
7
Original file line number Diff line number Diff line change @@ -34,5 +34,5 @@ internal static partial class LoggerExtensions
34
34
[ LoggerMessage ( LogLevel . Critical ) ]
35
35
public static partial void FoodRecallNotice (
36
36
this ILogger logger ,
37
- [ LogProperties ( OmitReferenceName = true ) ] FoodRecallNotice foodRecallNotice ) ;
37
+ [ LogProperties ( OmitReferenceName = true ) ] in FoodRecallNotice foodRecallNotice ) ;
38
38
}
Original file line number Diff line number Diff line change @@ -30,16 +30,12 @@ dotnet add package Microsoft.Extensions.Telemetry.Abstractions
30
30
Define a new complex data type, as shown in [ FoodRecallNotice.cs] ( ./FoodRecallNotice.cs ) :
31
31
32
32
``` csharp
33
- public class FoodRecallNotice
33
+ public struct FoodRecallNotice
34
34
{
35
35
public string ? BrandName { get ; set ; }
36
-
37
36
public string ? ProductDescription { get ; set ; }
38
-
39
37
public string ? ProductType { get ; set ; }
40
-
41
38
public string ? RecallReasonDescription { get ; set ; }
42
-
43
39
public string ? CompanyName { get ; set ; }
44
40
}
45
41
```
@@ -54,7 +50,7 @@ internal static partial class LoggerExtensions
54
50
[LoggerMessage (LogLevel .Critical )]
55
51
public static partial void FoodRecallNotice (
56
52
this ILogger logger ,
57
- [LogProperties (OmitReferenceName = true )] FoodRecallNotice foodRecallNotice );
53
+ [LogProperties (OmitReferenceName = true )] in FoodRecallNotice foodRecallNotice );
58
54
}
59
55
```
60
56
Original file line number Diff line number Diff line change 1
1
<Project Sdk =" Microsoft.NET.Sdk" >
2
2
<PropertyGroup >
3
3
<SuppressTfmSupportBuildWarnings >true</SuppressTfmSupportBuildWarnings >
4
+ <EmitCompilerGeneratedFiles >true</EmitCompilerGeneratedFiles >
4
5
</PropertyGroup >
5
6
<ItemGroup >
6
7
<PackageReference Include =" Microsoft.Extensions.Telemetry.Abstractions" />
You can’t perform that action at this time.
0 commit comments