CapyKit/Documentation/Help/M_CapyKit_CapyEventReporter_EmitEvent.md

58 lines
2.1 KiB
Markdown
Raw Permalink Normal View History

2024-04-21 03:30:36 -05:00
# EmitEvent Method
Emits an event with the given severity level, message, and method name.
## Definition
**Namespace:** <a href="N_CapyKit.md">CapyKit</a>
2024-09-04 19:31:43 -05:00
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.2
2024-04-21 03:30:36 -05:00
**C#**
``` C#
2024-06-24 01:17:33 -05:00
public static void EmitEvent(
2024-04-21 03:30:36 -05:00
EventLevel eventLevel,
string message,
string method = null,
params Object[] args
)
```
**F#**
``` F#
2024-06-24 01:17:33 -05:00
static member EmitEvent :
2024-04-21 03:30:36 -05:00
eventLevel : EventLevel *
message : string *
?method : string *
args : Object[]
(* Defaults:
let _method = defaultArg method null
*)
-> unit
```
#### Parameters
<dl><dt>  <a href="T_CapyKit_EventLevel.md">EventLevel</a></dt><dd>The severity level of the event.</dd><dt>  <a href="https://learn.microsoft.com/dotnet/api/system.string" target="_blank" rel="noopener noreferrer">String</a></dt><dd>The message describing the reason for the event. String formatting for <em>args</em> is accepted.</dd><dt>  <a href="https://learn.microsoft.com/dotnet/api/system.string" target="_blank" rel="noopener noreferrer">String</a>  (Optional)</dt><dd>(Optional) The name of the method where the event was raised.</dd><dt>  <a href="https://learn.microsoft.com/dotnet/api/system.object" target="_blank" rel="noopener noreferrer">Object</a>[]</dt><dd>A variable-length parameters list containing arguments for formatting the message.</dd></dl>
## Remarks
In order to allow for efficient calling member access via <a href="https://learn.microsoft.com/dotnet/api/system.runtime.compilerservices.callermembernameattribute" target="_blank" rel="noopener noreferrer">CallerMemberNameAttribute</a> , it is suggested that *args* is defined explicitly for formatted messages.
## Example
**C#**
``` C#
2024-04-21 03:30:36 -05:00
CapyEventReporter.EmitEvent(EventLevel.Error, "Could not find the description for {0}.", args: new[] { enumeration });
```
2024-04-21 03:30:36 -05:00
## See Also
#### Reference
<a href="T_CapyKit_CapyEventReporter.md">CapyEventReporter Class</a>
<a href="N_CapyKit.md">CapyKit Namespace</a>
<a href="https://learn.microsoft.com/dotnet/api/system.runtime.compilerservices.callermembernameattribute" target="_blank" rel="noopener noreferrer">CallerMemberNameAttribute</a>