Esempio n. 1
0
 private void AfterLog(ErrorStore store)
 {
     if (OnAfterLog != null)
     {
         try
         {
             OnAfterLog(store, new ErrorAfterLogEventArgs(this));
         }
         catch (Exception e)
         {
             Trace.WriteLine(e);
         }
     }
 }
        /// <summary>
        /// Logs this error to a specific store.
        /// </summary>
        /// <param name="store">The store to log to, if null the default is used.</param>
        /// <returns>The error if logged, or null if logging was aborted.</returns>
        public async Task <bool> LogToStoreAsync(ErrorStore store = null)
        {
            store = store ?? Settings.DefaultStore;
            var abort = Settings.BeforeLog(this, store);

            if (abort)
            {
                return(true);           // if we've been told to abort, then abort dammit!
            }
            Trace.WriteLine(Exception); // always echo the error to trace for local debugging
            await store.LogAsync(this).ConfigureAwait(false);

            Settings.AfterLog(this, store);

            return(true);
        }
Esempio n. 3
0
        /// <summary>
        /// Logs this error to a specific store.
        /// </summary>
        /// <param name="store">The store to log to, is null the default is used.</param>
        /// <returns>The error if logged, or null if logging was aborted.</returns>
        public bool LogToStore(ErrorStore store = null)
        {
            store = store ?? Settings.Current.DefaultStore;
            var abort = BeforeLog(store);

            if (abort)
            {
                return(true);           // if we've been told to abort, then abort dammit!
            }
            Trace.WriteLine(Exception); // always echo the error to trace for local debugging
            store.Log(this);

            AfterLog(store);

            return(true);
        }
Esempio n. 4
0
 private bool BeforeLog(ErrorStore store)
 {
     if (OnBeforeLog != null)
     {
         try
         {
             var args = new ErrorBeforeLogEventArgs(this);
             OnBeforeLog(store, args);
             if (args.Abort)
             {
                 return(true);
             }
         }
         catch (Exception e)
         {
             Trace.WriteLine(e);
         }
     }
     return(false);
 }
 /// <summary>
 /// Sets the default error store to use for logging
 /// </summary>
 /// <param name="applicationName">The application name to use when logging errors</param>
 /// <param name="store">The error store used to store, e.g. <code>new SQLErrorStore(myConnectionString)</code></param>
 public static void Setup(string applicationName, ErrorStore store)
 {
     _defaultStore = store;
     _applicationName = applicationName;
 }
Esempio n. 6
0
 /// <summary>
 /// Sets the default error store to use for logging
 /// </summary>
 /// <param name="applicationName">The application name to use when logging errors</param>
 /// <param name="store">The error store used to store, e.g. <code>new SQLErrorStore(myConnectionString)</code></param>
 public static void Setup(string applicationName, ErrorStore store)
 {
     _defaultStore    = store;
     _applicationName = applicationName;
 }
 /// <summary>
 /// Sets the default error store to use for logging.
 /// </summary>
 /// <param name="store">The error store used to store, e.g. <code>new SQLErrorStore(myConnectionString)</code></param>
 public static void Configure(ErrorStore store) =>
 Settings.SetDefaultStore(store ?? throw new ArgumentNullException(nameof(store)));
Esempio n. 8
0
 /// <summary>
 /// Sets the default error store to use for logging
 /// </summary>
 /// <param name="applicationName">The application name to use when logging errors</param>
 /// <param name="store">The error store used to store, e.g. <code>new SQLErrorStore(myConnectionString)</code></param>
 public static void Setup(string applicationName, ErrorStore store)
 {
     Exceptional.Settings.Current.DefaultStore = store;
     _applicationName = applicationName;
 }