public static void WriteToEventLog(this ICakeContext ctx, string message) { if (ctx == null) { throw new ArgumentNullException(nameof(ctx)); } if (ctx.IsInvalid()) { NotSupported(); } var settings = new EventLogEntrySettings(); var mgr = new EventLogManager(settings, ctx.Log); mgr.WriteToEventLog(message); }
public static bool EventLogExists(this ICakeContext ctx, string logName) { if (ctx == null) { throw new ArgumentNullException(nameof(ctx)); } if (ctx.IsInvalid()) { NotSupported(); } var settings = new EventLogEntrySettings { LogName = logName }; var mgr = new EventLogManager(settings, ctx.Log); return(mgr.LogExists()); }
public static bool EventSourceExists(this ICakeContext ctx, string sourceName) { if (ctx == null) { throw new ArgumentNullException(nameof(ctx)); } if (ctx.IsInvalid()) { NotSupported(); } var settings = new EventLogEntrySettings { SourceName = sourceName }; var mgr = new EventLogManager(settings, ctx.Log); var exists = mgr.SourceExists(); return(exists.HasValue && exists.Value); }