コード例 #1
0
        public void Should_contain_Console_targets_if_printing_to_console()
        {
            var loggingSettings = new LoggingSettings("Test", true);

            LoggingConfigurator.ConfigureLogging(loggingSettings);

            var logConfiguration = NLog.LogManager.Configuration;

            Assert.IsNotEmpty(logConfiguration.LoggingRules.Where(rule => rule.Targets.Any(target => target is ColoredConsoleTarget)));
        }
コード例 #2
0
        static async Task Main(string[] args)
        {
            AppDomain.CurrentDomain.AssemblyResolve += (s, e) => ResolveAssembly(e.Name);

            var arguments = new HostArguments(args);

            if (arguments.Help)
            {
                arguments.PrintUsage();
                return;
            }

            var loggingSettings = new LoggingSettings(arguments.ServiceName, false);

            LoggingConfigurator.ConfigureLogging(loggingSettings);

            await new CommandRunner(arguments.Commands).Execute(arguments)
            .ConfigureAwait(false);
        }