TagNameAttribute クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ログに記録されるパラメーターまたはプロパティに使用するタグ名を定義します。
public ref class TagNameAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Parameter | System.AttributeTargets.Property)]
[System.Diagnostics.Conditional("CODE_GENERATION_ATTRIBUTES")]
public sealed class TagNameAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Parameter | System.AttributeTargets.Property)>]
[<System.Diagnostics.Conditional("CODE_GENERATION_ATTRIBUTES")>]
type TagNameAttribute = class
inherit Attribute
Public NotInheritable Class TagNameAttribute
Inherits Attribute
- 継承
- 属性
例
[LoggerMessage(1, LogLevel.Information, "My custom tag name: {my.custom.tagname}")]
public static partial void LogMyCustomTagName(
this ILogger logger,
[TagName("my.custom.tagname")] string name);
注釈
既定では、タグ名はそれぞれのパラメーターまたはプロパティと同じです。 この属性を使用すると、既定値をオーバーライドし、カスタム タグ名を指定できます。
コンストラクター
| 名前 | 説明 |
|---|---|
| TagNameAttribute(String) |
TagNameAttribute クラスの新しいインスタンスを初期化します。 |
プロパティ
| 名前 | 説明 |
|---|---|
| Name |
パラメーターまたはプロパティをログに記録するときに使用するタグの名前を取得します。 |