EventAttribute 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
이벤트에 대한 추가 이벤트 스키마 정보를 지정합니다.
public ref class EventAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Method)]
public sealed class EventAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method)>]
type EventAttribute = class
inherit Attribute
Public NotInheritable Class EventAttribute
Inherits Attribute
- 상속
- 특성
예제
다음 예제에서는 클래스를 사용하여 EventAttribute 다양한 이벤트를 정의하는 방법을 보여 줍니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 EventSource 클래스입니다.
[Event(1, Message = "Application Failure: {0}", Level = EventLevel.Error, Keywords = Keywords.Diagnostic)]
public void Failure(string message) { WriteEvent(1, message); }
<[Event](1, Message:="Application Failure: {0}", Level:=EventLevel.Error, Keywords:=Keywords.Diagnostic)> _
Public Sub Failure(ByVal message As String)
WriteEvent(1, message)
End Sub
[Event(2, Message = "Starting up.", Keywords = Keywords.Perf, Level = EventLevel.Informational)]
public void Startup() { WriteEvent(2); }
<[Event](2, Message:="Starting up.", Keywords:=Keywords.Perf, Level:=EventLevel.Informational)> _
Public Sub Startup()
WriteEvent(2)
End Sub
[Event(3, Message = "loading page {1} activityID={0}", Opcode = EventOpcode.Start,
Task = Tasks.Page, Keywords = Keywords.Page, Level = EventLevel.Informational)]
public void PageStart(int ID, string url) { if (IsEnabled()) WriteEvent(3, ID, url); }
<[Event](3, Message:="loading page {1} activityID={0}", Opcode:=EventOpcode.Start, Task:=Tasks.Page, Keywords:=Keywords.Page, Level:=EventLevel.Informational)> _
Public Sub PageStart(ByVal ID As Integer, ByVal url As String)
If IsEnabled() Then
WriteEvent(3, ID, url)
End If
End Sub
[Event(4, Opcode = EventOpcode.Stop, Task = Tasks.Page, Keywords = Keywords.Page, Level = EventLevel.Informational)]
public void PageStop(int ID) { if (IsEnabled()) WriteEvent(4, ID); }
<[Event](4, Opcode:=EventOpcode.Stop, Task:=Tasks.Page, Keywords:=Keywords.Page, Level:=EventLevel.Informational)> _
Public Sub PageStop(ByVal ID As Integer)
If IsEnabled() Then
WriteEvent(4, ID)
End If
End Sub
설명
파생 클래스에 정의된 ETW 이벤트 메서드에 EventSource이 특성을 적용하는 경우 기본 클래스에서 메서드를 호출 WriteEvent 하고 이벤트 ID를 전달한 다음 정의된 메서드와 동일한 인수를 전달해야 합니다. 다음 예제에 표시된 패턴을 따라야 합니다.
생성자
EventAttribute(Int32) |
지정된 이벤트 식별자를 사용하여 EventAttribute 클래스의 새 인스턴스를 초기화합니다. |
속성
ActivityOptions |
작업의 시작 및 중지 이벤트라는 동작을 정의합니다. 작업은 시작과 중지 사이의 앱의 시간 영역입니다. |
Channel |
이벤트를 작성해야 하는 추가 이벤트 로그를 가져오거나 설정합니다. |
EventId |
이벤트의 식별자를 가져오거나 설정합니다. |
Keywords |
이벤트에 대한 키워드를 가져오거나 설정합니다. |
Level |
이벤트의 수준을 가져오거나 설정합니다. |
Message |
이벤트에 대한 메시지를 가져오거나 설정합니다. |
Opcode |
이벤트의 작업 코드를 가져오거나 설정합니다. |
Tags |
이 EventAttribute 개체의 EventTags 값을 가져오거나 설정합니다. 이벤트 태그는 이벤트를 기록하는 경우 전달되는 사용자 정의 값입니다. |
Task |
이벤트의 작업을 가져오거나 설정합니다. |
TypeId |
파생 클래스에서 구현된 경우 이 Attribute에 대한 고유 식별자를 가져옵니다. (다음에서 상속됨 Attribute) |
Version |
이벤트 버전을 가져오거나 설정합니다. |
메서드
Equals(Object) |
이 인스턴스가 지정된 개체와 같은지를 나타내는 값을 반환합니다. (다음에서 상속됨 Attribute) |
GetHashCode() |
이 인스턴스의 해시 코드를 반환합니다. (다음에서 상속됨 Attribute) |
GetType() |
현재 인스턴스의 Type을 가져옵니다. (다음에서 상속됨 Object) |
IsDefaultAttribute() |
파생 클래스에서 재정의된 경우 이 인스턴스 값이 파생 클래스에 대한 기본값인지 여부를 표시합니다. (다음에서 상속됨 Attribute) |
Match(Object) |
파생 클래스에서 재정의된 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다. (다음에서 상속됨 Attribute) |
MemberwiseClone() |
현재 Object의 단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
ToString() |
현재 개체를 나타내는 문자열을 반환합니다. (다음에서 상속됨 Object) |
명시적 인터페이스 구현
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
이름 집합을 해당하는 디스패치 식별자 집합에 매핑합니다. (다음에서 상속됨 Attribute) |
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) |
인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다. (다음에서 상속됨 Attribute) |
_Attribute.GetTypeInfoCount(UInt32) |
개체에서 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1). (다음에서 상속됨 Attribute) |
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
개체에서 노출하는 메서드와 속성에 대한 액세스를 제공합니다. (다음에서 상속됨 Attribute) |