I'd like to be able to declare an EventSource which has a minimum of several methods which by default provide regular logging facilities.
e.g.
- Info()
- Warn()
- Error()
In addition I'd like to be able to within each service, define a specific event source that inherits from the base class providing the above. At the moment the EventRegister.exe app which creates the manifest complains that the event source must be sealed.
Am I doing this wrong? If so how can I achieve the above? See example code:
public class ETWBase : EventSource
{
[Event(1, Channel = EventChannel.Admin, Message = "Info Message: {0}")]
public void Info(string message) { this.WriteEvent(1); }
[Event(2, Channel = EventChannel.Debug, Message = "Debug Message: {0}")]
public void Trace(string message) { this.WriteEvent(2); }
}
[EventSource(Name = "ABC-MyEtwServiceEventSource")]
public sealed class MyEtwServiceEventSource : ETWBase
{
public static MyEtwServiceEventSource Log = new MyEtwServiceEventSource();
[Event(3, Channel = EventChannel.Debug, Message = "My specific Message: {0}")]
public void Trace(string message) { this.WriteEvent(3); }
}
I'm using the latest and greatest Microsoft.Diagnostics.Tracing (pre) which I understand has support for Channels unlike the SLAB from Enterprise Library.