public void Initialize(IEventSource eventSource) { eventSource.TaskStarted += (sender, args) => { if (args.TaskName == "SyncUnicorn") { _loggingActive = true; LoggerAsync.Log("========== SyncUnicorn started =========="); } }; eventSource.TaskFinished += (sender, args) => { if (args.TaskName == "SyncUnicorn") { _loggingActive = false; LoggerAsync.Log("========== SyncUnicorn finished =========="); } }; eventSource.AnyEventRaised += (sender, args) => { if (_loggingActive) { LoggerAsync.Log(args.Message); } }; }
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); LoggerAsync.Initialize(this, "Sync Unicorn"); await SyncUnicornCommand.InitializeAsync(this); }
public SyncUnicornLogger() { LoggerAsync.Clear(); }