private bool Trace(PowerShellTraceEvent traceEvent, PowerShellTraceLevel level, PowerShellTraceOperationCode operationCode, PowerShellTraceTask task, params object[] args) { EventDescriptor eventDescriptor = new EventDescriptor((int) traceEvent, 1, (byte) this._traceChannel, (byte) level, (byte) operationCode, (int) task, (long) this._keywords); if (args != null) { for (int i = 0; i < args.Length; i++) { if (args[i] == null) { args[i] = string.Empty; } } } return _provider.WriteEvent(ref eventDescriptor, args); }
internal PowerShellTraceSource(PowerShellTraceTask task, PowerShellTraceKeywords keywords) { if (this.IsEtwSupported) { this.debugChannel = new PowerShellChannelWriter(PowerShellTraceChannel.Debug, keywords | (PowerShellTraceKeywords.None | PowerShellTraceKeywords.UseAlwaysDebug)); this.analyticChannel = new PowerShellChannelWriter(PowerShellTraceChannel.Analytic, keywords | (PowerShellTraceKeywords.None | PowerShellTraceKeywords.UseAlwaysAnalytic)); this.operationsChannel = new PowerShellChannelWriter(PowerShellTraceChannel.Operational, keywords | (PowerShellTraceKeywords.None | PowerShellTraceKeywords.UseAlwaysOperational)); this.task = task; this.keywords = keywords; } else { this.debugChannel = NullWriter.Instance; this.analyticChannel = NullWriter.Instance; this.operationsChannel = NullWriter.Instance; } }
/// <summary> /// TraceDebug /// </summary> public override bool TraceDebug(PowerShellTraceEvent traceEvent, PowerShellTraceOperationCode operationCode, PowerShellTraceTask task, params object[] args) { // TODO: There is some error thrown by the custom debug level // hence Informational is being used return(Trace(traceEvent, PowerShellTraceLevel.Informational, operationCode, task, args)); }
/// <summary> /// TraceInformational /// </summary> public override bool TraceInformational(PowerShellTraceEvent traceEvent, PowerShellTraceOperationCode operationCode, PowerShellTraceTask task, params object[] args) { return(Trace(traceEvent, PowerShellTraceLevel.Informational, operationCode, task, args)); }
public virtual bool TraceWarning(PowerShellTraceEvent traceEvent, PowerShellTraceOperationCode operationCode, PowerShellTraceTask task, params object[] args) { return true; }
/// <summary> /// Returns an instance of BaseChannelWriter. /// If the Etw is not supported by the platform it will return NullWriter.Instance /// /// A Task and a set of Keywords can be specified in the GetTraceSource method (See overloads). /// The supplied task and keywords are used to pass to the Etw provider in case they are /// not defined in the manifest file. /// </summary> public static PowerShellTraceSource GetTraceSource(PowerShellTraceTask task, PowerShellTraceKeywords keywords) { return new PowerShellTraceSource(task, keywords); }
internal PowerShellTraceSource(PowerShellTraceTask task, PowerShellTraceKeywords keywords) { }
public override bool TraceVerbose(PowerShellTraceEvent traceEvent, PowerShellTraceOperationCode operationCode, PowerShellTraceTask task, params object[] args) { return(this.Trace(traceEvent, PowerShellTraceLevel.Verbose, operationCode, task, args)); }
/// <summary> /// TraceCritical /// </summary> public virtual bool TraceCritical(PowerShellTraceEvent traceEvent, PowerShellTraceOperationCode operationCode, PowerShellTraceTask task, params object[] args) { return(true); }
public override bool TraceDebug(PowerShellTraceEvent traceEvent, PowerShellTraceOperationCode operationCode, PowerShellTraceTask task, params object[] args) { return this.Trace(traceEvent, PowerShellTraceLevel.Informational, operationCode, task, args); }
/// <summary> /// Constructor /// </summary> internal PowerShellTraceSource(PowerShellTraceTask task, PowerShellTraceKeywords keywords) { if (IsEtwSupported) { DebugChannel = new PowerShellChannelWriter(PowerShellTraceChannel.Debug, keywords | PowerShellTraceKeywords.UseAlwaysDebug); AnalyticChannel = new PowerShellChannelWriter(PowerShellTraceChannel.Analytic, keywords | PowerShellTraceKeywords.UseAlwaysAnalytic); OperationalChannel = new PowerShellChannelWriter(PowerShellTraceChannel.Operational, keywords | PowerShellTraceKeywords.UseAlwaysOperational); this.Task = task; this.Keywords = keywords; } else { DebugChannel = NullWriter.Instance; AnalyticChannel = NullWriter.Instance; OperationalChannel = NullWriter.Instance; } }
/// <summary> /// TraceCritical /// </summary> public override bool TraceCritical(PowerShellTraceEvent traceEvent, PowerShellTraceOperationCode operationCode, PowerShellTraceTask task, params object[] args) { return Trace(traceEvent, PowerShellTraceLevel.Critical, operationCode, task, args); }
/// <summary> /// TraceDebug /// </summary> public override bool TraceDebug(PowerShellTraceEvent traceEvent, PowerShellTraceOperationCode operationCode, PowerShellTraceTask task, params object[] args) { // TODO: There is some error thrown by the custom debug level // hence Informational is being used return Trace(traceEvent, PowerShellTraceLevel.Informational, operationCode, task, args); }
private bool Trace(PowerShellTraceEvent traceEvent, PowerShellTraceLevel level, PowerShellTraceOperationCode operationCode, PowerShellTraceTask task, params object[] args) { EventDescriptor ed = new EventDescriptor((int)traceEvent, 1, (byte)_traceChannel, (byte)level, (byte)operationCode, (int)task, (long)_keywords); /* * Not using locks because the _provider is thread safe itself. **/ if (args != null) { for (int i = 0; i < args.Length; i++) { if (args[i] == null) { args[i] = string.Empty; } } } return _provider.WriteEvent(ref ed, args); }
/// <summary> /// Returns an instance of BaseChannelWriter. /// If the Etw is not supported by the platform it will return NullWriter.Instance /// /// A Task and a set of Keywords can be specified in the GetTraceSource method (See overloads). /// The supplied task and keywords are used to pass to the Etw provider in case they are /// not defined in the manifest file. /// </summary> public static PowerShellTraceSource GetTraceSource(PowerShellTraceTask task, PowerShellTraceKeywords keywords) { return(new PowerShellTraceSource(task, keywords)); }
public override bool TraceWarning(PowerShellTraceEvent traceEvent, PowerShellTraceOperationCode operationCode, PowerShellTraceTask task, params object[] args) { return this.Trace(traceEvent, PowerShellTraceLevel.Warning, operationCode, task, args); }
/// <summary> /// TraceWarning /// </summary> public override bool TraceWarning(PowerShellTraceEvent traceEvent, PowerShellTraceOperationCode operationCode, PowerShellTraceTask task, params object[] args) { return(Trace(traceEvent, PowerShellTraceLevel.Warning, operationCode, task, args)); }
private bool Trace(PowerShellTraceEvent traceEvent, PowerShellTraceLevel level, PowerShellTraceOperationCode operationCode, PowerShellTraceTask task, params object[] args) { EventDescriptor eventDescriptor = new EventDescriptor((int)traceEvent, 1, (byte)this._traceChannel, (byte)level, (byte)operationCode, (int)task, (long)this._keywords); if (args != null) { for (int i = 0; i < args.Length; i++) { if (args[i] == null) { args[i] = string.Empty; } } } return(_provider.WriteEvent(ref eventDescriptor, args)); }