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);

설명

기본적으로 태그 이름은 해당 매개 변수 또는 속성과 동일합니다. 이 특성을 사용하여 기본값을 재정의하고 사용자 지정 태그 이름을 제공할 수 있습니다.

생성자

Name Description
TagNameAttribute(String)

TagNameAttribute 클래스의 새 인스턴스를 초기화합니다.

속성

Name Description
Name

매개 변수 또는 속성을 로깅할 때 사용할 태그의 이름을 가져옵니다.

적용 대상

추가 정보