Ejemplo n.º 1
0
 public void Fatal(string message)
 {
     if (log.IsFatalEnabled)
     {
         log.Fatal(message);
     }
 }
Ejemplo n.º 2
0
        public void Log(LogEntry entry)
        {
            _logger = GetLogger(INFO);
            switch (entry.Severity)
            {
            case LoggingEventType.Debug:
                _logger.Debug(entry.Exception, entry.Message);
                break;

            case LoggingEventType.Information:
                _logger.Info(entry.Exception, entry.Message);
                break;

            case LoggingEventType.Warning:
                _logger.Warn(entry.Exception, entry.Message);
                break;

            case LoggingEventType.Error:
                _logger.Error(entry.Exception);
                break;

            case LoggingEventType.Fatal:
                _logger.Fatal(entry.Exception, entry.Message);
                break;

            default:
                break;
            }
        }
Ejemplo n.º 3
0
 public void Fatal(object message)
 {
     if (IsFatalEnabled)
     {
         loger.Fatal(message);
     }
 }
Ejemplo n.º 4
0
 private static void UnhandledExceptionTrapper(object sender, UnhandledExceptionEventArgs e)
 {
     Logger.Fatal(e.ExceptionObject);
     Console.WriteLine(e.ExceptionObject.ToString());
     Console.WriteLine("");
     Console.WriteLine("FATAL ERROR - Press return to close...");
     Console.ReadLine();
     Environment.Exit(1);
 }
Ejemplo n.º 5
0
 public static void ShowUnhandledException(Exception ex)
 {
     if (logger == null)
     {
         throw ex;
     }
     logger.Fatal(ex, "Unhandled EXCEPTION: {0}  \r\n {1} - {2}",
                  ex.ToString(), ex.InnerException?.Message, ex.InnerException?.StackTrace);
 }
Ejemplo n.º 6
0
 protected override void OnStart(string[] args)
 {
     try
     {
         _webHost = BuildWebHost(args);
         _webHost.Start();
     }
     catch (Exception e)
     {
         _logger.Fatal(e);
         throw;
     }
 }
Ejemplo n.º 7
0
            protected override void OnStart(string[] args)
            {
                try
                {
//                  string[] imagePathArgs = Environment.GetCommandLineArgs();
                    _webHost = BuildWebHost(args);
                    _webHost.Start();
                }
                catch (Exception e)
                {
                    _logger.Fatal(e);
                    throw;
                }
            }
Ejemplo n.º 8
0
        public static void Main(string[] args)
        {
            NLog.ILogger Log = LogManager.GetCurrentClassLogger();

            try
            {
                Log.Info("Starting web host");
                CreateWebHostBuilder(args).Build().Run();
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "Host terminated unexpectedly");
            }
        }
Ejemplo n.º 9
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            var logDir = new DirectoryInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "OnPointTestApp"));

            if (!logDir.Exists)
            {
                logDir.Create();
                logDir.Refresh();
            }

            string logDirPath           = Path.Combine(logDir.FullName, "Logs");
            LoggingConfiguration config = new LoggingConfiguration();

            FileTarget fileTarget = new FileTarget()
            {
                KeepFileOpen = false
            };
            string logFilePath = Path.Combine(logDirPath, $"{Environment.UserName}_{DateTime.Now.ToString("yyyyMMdd_HHmmss")}.txt");

            fileTarget.FileName = logFilePath;
            fileTarget.Layout   = @"${date:format=hh\:mm\:ss.fff tt} ~ ${level} ~ ${message} ${exception:maxInnerExceptionLevel=3:format=ToString,StackTrace}";
            config.LoggingRules.Add(new LoggingRule("*", NLog.LogLevel.Trace, fileTarget));
            config.AddTarget("file", new AsyncTargetWrapper(fileTarget));
            LogManager.Configuration = config;

            NLog.ILogger logger = LogManager.GetCurrentClassLogger();
            logger.Fatal($"OnPoint Test App started.");

            Locator.CurrentMutable.Register(() => new CustomPropertyResolver(), typeof(ICreatesObservableForProperty));
            Locator.CurrentMutable.UseNLogWithWrappingFullLogger();

            Locator.CurrentMutable.Register(() => new RootView(), typeof(IViewFor <RootVM>));
            Locator.CurrentMutable.Register(() => new MainView(), typeof(IViewFor <MainVM>));
            Locator.CurrentMutable.Register(() => new PeopleView(), typeof(IViewFor <PeopleVM>));
            Locator.CurrentMutable.Register(() => new NumbersView(), typeof(IViewFor <NumbersVM>));
            Locator.CurrentMutable.Register(() => new LettersView(), typeof(IViewFor <LettersVM>));

            new MainWindow()
            {
                DataContext = new RootVM()
            }.Show();
        }
Ejemplo n.º 10
0
 private static void UnhandledExceptionTrapper(object sender, UnhandledExceptionEventArgs e)
 {
     Logger.Fatal(e.ExceptionObject);
     Console.WriteLine(e.ExceptionObject.ToString());
     Environment.Exit(1);
 }
Ejemplo n.º 11
0
 public void Fatal(string message)
 {
     logger.Fatal(message);
 }
Ejemplo n.º 12
0
 public void LogFatal(Exception exception, string message)
 {
     _logger.Fatal(exception, message);
 }
 public void PerformanceHelperFatal(string memo)
 {
     Instance.Fatal(memo);
 }
Ejemplo n.º 14
0
 public void Fatal(string loggingMessage, [CallerMemberName] string memberName = "")
 {
     System.Diagnostics.Trace.WriteLine($"Fatal Message from {memberName}");
     _logger.Fatal(loggingMessage);
 }