public void OnNext(EventEntry value)
 {
     if (value != null && (value.Schema.Level == EventLevel.Error || value.Schema.Level == EventLevel.Critical))
     {
         EventSourceRegistrar.RecordSessionError(value);
     }
 }
Esempio n. 2
0
        protected EventSourceBase()
        {
            var listener = new ObservableEventListener();

            listener.EnableEvents(this, Verbosity, Keywords.All);
            listener.LogToSystemDiagnosticsTrace(); //application diagnostics will upload these to azure tables

            if (SiteUtil.InWebJob)
            {
                listener.LogToConsole();     //needed for webjob logs (e.g. https://howlongtobeatsteam.scm.azurewebsites.net/azurejobs/#/jobs)
                listener.LogSessionErrors(); // log errors so they can be sent at the end of the run
            }

            EventSourceRegistrar.RegisterEventListener(this, listener);
        }
 public void OnError(Exception error)
 {
     EventSourceRegistrar.RecordSessionError(
         new EventEntry(Guid.Empty, -1, Invariant($"Error in SLAB provider: {error}"), new ReadOnlyCollection <object>(new object[] {}), DateTimeOffset.UtcNow,
                        new EventSchema(-1, Guid.Empty, "SLAB", EventLevel.Error, EventTask.None, "", EventOpcode.Info, "", EventKeywords.None, "", 0, new string[] {})));
 }