Skip to content

Instantly share code, notes, and snippets.

@lzybkr
Last active October 19, 2017 23:26
Show Gist options
  • Save lzybkr/6e4436d300a9050ef398a2f15554fc12 to your computer and use it in GitHub Desktop.
Save lzybkr/6e4436d300a9050ef398a2f15554fc12 to your computer and use it in GitHub Desktop.
enum Color { Red; Green; Blue }
[System.Diagnostics.Tracing.EventSource(Name = "MyPSEventSource")]
class C : System.Diagnostics.Tracing.EventSource
{
[System.Diagnostics.Tracing.Event(1)]
[void] SomeRandomEvent([string]$Message, [Color]$Color)
{
$this.WriteEvent([int]1, [string]$Message, [int]$Color)
}
}
$c = [C]::new()
1..1000 | % {
$c.SomeRandomEvent("Event $_", [Color]($_ % 3))
sleep -Milliseconds 500
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment