TagNameAttribute クラス

定義

ログに記録されるパラメーターまたはプロパティに使用するタグ名を定義します。

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
継承
TagNameAttribute
属性

[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

パラメーターまたはプロパティをログに記録するときに使用するタグの名前を取得します。

適用対象

こちらもご覧ください