private static bool EnsureLogExists(EventLogEntrySettings settings, ICakeLog log) { var mgr = new EventLogManager(settings, log); if (mgr.LogExists()) { return(true); } mgr.CreateLog(); return(mgr.LogExists()); }
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()); }