Exemple #1
0
 public static ISimpleLog GetOrCreateLogFor(this ISimpleLogFactory factory, object instance)
 {
     if (instance == null)
     {
         throw new ArgumentNullException(nameof(instance));
     }
     if (instance is Type type)
     {
         return(factory.GetOrCreateLogFor(type));
     }
     return(factory.GetOrCreateLogFor(instance.GetType()));
 }
Exemple #2
0
 private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     if (e.ExceptionObject is Exception ex)
     {
         var simpleLog = _simpleLogFactory.GetOrCreateLogFor(typeof(Program));
         simpleLog.LogEx(ex);
     }
 }
Exemple #3
0
 public static ISimpleLog GetOrCreateLogFor <T>(this ISimpleLogFactory factory)
 {
     return(factory.GetOrCreateLogFor(typeof(T)));
 }