예제 #1
0
        public void DoSomeWork()
        {
            output.WriteLine("Hello world");

            logger.Debug("My application - DEBUG");
            logger.Info("My application - INFO");
            logger.Warn("My application - WARN");
            logger.Error("My application - ERROR");

            logger.Info("format: " + applicationConfiguration.Get("format", "word"));
            logger.Info("sendmail: " + applicationConfiguration.Get("sendmail", "false"));

            logger.Warn("Input file : " + cmdArgs.InFile);
            logger.Warn("Output file: " + cmdArgs.OutFile);

            cmdArgs.ShowHelp();

            new[]
            {
                new{ FirstName = "John", LastName = "Smith" },
                new{ FirstName = "Jane", LastName = "Doe" },
                new{ FirstName = "Vijay", LastName = "Gill" },
            }.AsTableFormatter(output)
            .Column("First Name", 30, a => a.FirstName)
            .Column("Surname", 30, a => a.LastName)
            .Print("People",
                   "This is header 1",
                   "This is header 2"
                   );
        }
        public LogEnricherJob(
            ILogger logger,
            IGeoIpFetcher geoIpFetcher,
            IApplicationConfiguration<IMicroServicesCoreConfiguration> configuration)
            : base(logger)
        {
            _geoIpFetcher = geoIpFetcher;
            _configuration = configuration;

            var elasticSearchUrl = _configuration.Get(c => c.ElasticSearchUrl);
            _elasticClient = new ElasticClient(new ConnectionSettings(new Uri(elasticSearchUrl)));
        }