Exemplo n.º 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()));
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 3
0
 public static ISimpleLog GetOrCreateLogFor <T>(this ISimpleLogFactory factory)
 {
     return(factory.GetOrCreateLogFor(typeof(T)));
 }