Write() public method

public Write ( string message, LogLevel logLevel ) : void
message string
logLevel LogLevel
return void
コード例 #1
0
        int main(string[] args)
        {
            // NB: Trying to delete the app directory while we have Setup.log
            // open will actually crash the uninstaller
            bool isUninstalling = args.Any(x => x.Contains("uninstall"));

            // Uncomment to test Gifs
            //AnimatedGifWindow.ShowWindow(TimeSpan.FromMilliseconds(0), animatedGifWindowToken.Token);
            //Thread.Sleep(10 * 60 * 1000);

            using (var logger = new SetupLogLogger(isUninstalling)
            {
                Level = LogLevel.Info
            })
            {
                Locator.CurrentMutable.Register(() => logger, typeof(Splat.ILogger));
                try
                {
                    return(executeCommandLine(args));
                }
                catch (Exception ex)
                {
                    logger.Write("Unhandled exception: " + ex, LogLevel.Fatal);
                    throw;
                }
                // Ideally we would deregister the logger from the Locator before it was disposed - this is a hazard as it is at the moment
            }
        }
コード例 #2
0
        int main(string[] args)
        {
            try {
                opt = new StartupOption(args);
            } catch (Exception ex) {
                using (var logger = new SetupLogLogger(true, "OptionParsing")
                {
                    Level = LogLevel.Info
                }) {
                    Locator.CurrentMutable.Register(() => logger, typeof(Splat.ILogger));
                    logger.Write($"Failed to parse command line options. {ex.Message}", LogLevel.Error);
                }
                throw;
            }

            // NB: Trying to delete the app directory while we have Setup.log
            // open will actually crash the uninstaller
            bool isUninstalling = opt.updateAction == UpdateAction.Uninstall;

            using (var logger = new SetupLogLogger(isUninstalling, opt.updateAction.ToString())
            {
                Level = LogLevel.Info
            }) {
                Locator.CurrentMutable.Register(() => logger, typeof(Splat.ILogger));

                try {
                    return(executeCommandLine(args));
                } catch (Exception ex) {
                    logger.Write("Finished with unhandled exception: " + ex, LogLevel.Fatal);
                    throw;
                }
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: fusetools/Squirrel.Windows
 int main(string[] args)
 {
     using (var logger = new SetupLogLogger() {Level = LogLevel.Info}) {
         Locator.CurrentMutable.Register(() => logger, typeof (Splat.ILogger));
         try {
             return executeCommandLine(args, logger.LogPath);
         } catch (Exception ex) {
             logger.Write("Unhandled exception: " + ex, LogLevel.Fatal);
             throw;
         }
         // Ideally we would deregister the logger from the Locator before it was disposed - this is a hazard as it is at the moment
     }
 }
コード例 #4
0
 int main(string[] args)
 {
     using (var logger = new SetupLogLogger()
     {
         Level = LogLevel.Info
     }) {
         Locator.CurrentMutable.Register(() => logger, typeof(Splat.ILogger));
         try {
             return(executeCommandLine(args, logger.LogPath));
         } catch (Exception ex) {
             logger.Write("Unhandled exception: " + ex, LogLevel.Fatal);
             throw;
         }
         // Ideally we would deregister the logger from the Locator before it was disposed - this is a hazard as it is at the moment
     }
 }
コード例 #5
0
        int main(string[] args)
        {
            // NB: Trying to delete the app directory while we have Setup.log
            // open will actually crash the uninstaller
            bool isUninstalling = args.Any(x => x.Contains("uninstall"));

            using (var logger = new SetupLogLogger(isUninstalling) {Level = LogLevel.Info}) {
                Locator.CurrentMutable.Register(() => logger, typeof (Splat.ILogger));

                try {
                    return executeCommandLine(args);
                } catch (Exception ex) {
                    logger.Write("Unhandled exception: " + ex, LogLevel.Fatal);
                    throw;
                }
            }
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: Ribeiro/Squirrel.Windows
        int main(string[] args)
        {
            // NB: Trying to delete the app directory while we have Setup.log 
            // open will actually crash the uninstaller
            bool isUninstalling = args.Any(x => x.Contains("uninstall"));

            // Uncomment to test Gifs
            //AnimatedGifWindow.ShowWindow(TimeSpan.FromMilliseconds(0), animatedGifWindowToken.Token);
            //Thread.Sleep(10 * 60 * 1000);

            using (var logger = new SetupLogLogger(isUninstalling) {Level = LogLevel.Info}) {
                Locator.CurrentMutable.Register(() => logger, typeof (Splat.ILogger));
                try {
                    return executeCommandLine(args);
                } catch (Exception ex) {
                    logger.Write("Unhandled exception: " + ex, LogLevel.Fatal);
                    throw;
                }
                // Ideally we would deregister the logger from the Locator before it was disposed - this is a hazard as it is at the moment
            }
        }