当前位置: 首页>>代码示例>>C#>>正文


C# Logger.ErrorException方法代码示例

本文整理汇总了C#中NLog.Logger.ErrorException方法的典型用法代码示例。如果您正苦于以下问题:C# Logger.ErrorException方法的具体用法?C# Logger.ErrorException怎么用?C# Logger.ErrorException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NLog.Logger的用法示例。


在下文中一共展示了Logger.ErrorException方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MainClass

        public MainClass(string [] args)
        {
            Ticker.Tick();

            // required for the MS .NET runtime that doesn't initialize glib automatically
            if (!GLib.Thread.Supported)
                GLib.Thread.Init();

            // Connect to dbus
            DBusInstance DBusInstance = ServiceManager.Get <DBusInstance> ();
            DBusInstance.Initialise ();

            if (DBusInstance.AlreadyRunning)
            {
                Console.WriteLine("Already running");
                DBusInstance.CommandParser.ParseCommands (args);
                return;
            }

            DBusInstance.CommandParser.RunCommand += HandleCommand;

            Ticker.Tick();
            CheckDataFolders();
            Ticker.Tock ("Checking folders");

            foreach (string arg in args)
                HandleCommand (arg);

            Ticker.Tick ();
            if (DebugEnabled) {
                BuildNlogConfig();
            }
            logger = DebugEnabled ? NLog.LogManager.GetCurrentClassLogger () : new EmptyLogger ();
            Ticker.Tock("NLog");

            logger.Info("Starting Monsoon");

            Ticker.Tick ();
            SetProcessName("monsoon");
            Ticker.Tock("Setting process name");

            string localeDir = Path.Combine(Defines.ApplicationDirectory, "locale");
            if (!Directory.Exists(localeDir)) {
                localeDir = Path.Combine(Defines.InstallPrefix, "share");
                localeDir = Path.Combine(localeDir, "locale");
            }

            Ticker.Tick ();
            Mono.Unix.Catalog.Init("monsoon", localeDir);
            logger.Debug("Using locale data from: {0}", localeDir);

            Application.Init("monsoon", ref args);
            Ticker.Tock("Locale");

            try {
                SettingsManager.Restore <EngineSettings> (SettingsManager.EngineSettings);
                SettingsManager.Restore <PreferencesSettings> (SettingsManager.Preferences);
                SettingsManager.Restore <TorrentSettings> (SettingsManager.DefaultTorrentSettings);
            }
            catch (Exception ex) {
                logger.Error("Couldn't restore old settings: {0}", ex.Message);
            }

            try
            {
                Ticker.Tick();
                mainWindow = new MainWindow ();
                Ticker.Tock ("Instantiating window");

            }
            catch(Exception e)
            {
                logger.ErrorException(e.Message, e);
                Environment.Exit (0);
            }

            LoadAddins ();

            GLib.ExceptionManager.UnhandledException += new GLib.UnhandledExceptionHandler(OnUnhandledException);

            Ticker.Tock ("Total time:");
            Application.Run();

            try {
                SettingsManager.Store <EngineSettings> (SettingsManager.EngineSettings);
                SettingsManager.Store <PreferencesSettings> (SettingsManager.Preferences);
                SettingsManager.Store <TorrentSettings> (SettingsManager.DefaultTorrentSettings);
            }
            catch (Exception ex) {
                logger.Error("Could save engine settings: {0}", ex.Message);
            }
            ServiceManager.Get <ListenPortController> ().Stop ();
            mainWindow.Destroy ();
        }
开发者ID:ArsenShnurkov,项目名称:monsoon,代码行数:94,代码来源:Main.cs


注:本文中的NLog.Logger.ErrorException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。