/// <summary> /// Determines whether any session is requesting the specified event from the provider. /// </summary> /// <param name="level"></param> /// <param name="keywords"></param> /// <returns></returns> /// <remarks> /// Typically, a provider does not call this method to determine whether a session requested the specified event; /// the provider simply writes the event, and ETW determines whether the event is logged to a session. A provider /// may want to call this function if the provider needs to perform extra work to generate the event. In this case, /// calling this function first to determine if a session requested the event or not, may save resources and time. /// </remarks> internal bool IsEnabled(PSLevel level, PSKeyword keywords) { return etwProvider.IsEnabled((byte)level, (long)keywords); }
internal void WriteEvent(PSEventId id, PSChannel channel, PSOpcode opcode, PSLevel level, PSTask task, PSKeyword keyword, params object[] args) { long keywords = 0L; if ((keyword == PSKeyword.UseAlwaysAnalytic) || (keyword == PSKeyword.UseAlwaysOperational)) { keywords = 0L; } else { keywords = (long) keyword; } System.Diagnostics.Eventing.EventDescriptor eventDescriptor = new System.Diagnostics.Eventing.EventDescriptor((int) id, 1, (byte) channel, (byte) level, (byte) opcode, (int) task, keywords); etwProvider.WriteEvent(ref eventDescriptor, args); }
/// <summary> /// Writes an event /// </summary> /// <param name="id"></param> /// <param name="channel"></param> /// <param name="opcode"></param> /// <param name="level"></param> /// <param name="task"></param> /// <param name="keyword"></param> /// <param name="args"></param> internal void WriteEvent(PSEventId id, PSChannel channel, PSOpcode opcode, PSLevel level, PSTask task, PSKeyword keyword, params object[] args) { long longKeyword = 0x00; if (keyword == PSKeyword.UseAlwaysAnalytic || keyword == PSKeyword.UseAlwaysOperational) { longKeyword = 0x00; } else { longKeyword = (long)keyword; } EventDescriptor desc = new EventDescriptor((int)id, (byte)PSEventVersion.One, (byte)channel, (byte)level, (byte)opcode, (int)task, longKeyword); etwProvider.WriteEvent(ref desc, args); }
internal abstract void WriteEvent( PSEventId id, PSLevel level, PSOpcode opcode, PSTask task, params object[] args);