Пример #1
0
        static void Main(string[] args)

        {
            Stream       st     = File.OpenRead(@"C:\Users\tarun.tank\source\repos\log\VerifyLogging\log4net.config");
            CustomLogger logger = new CustomLogger(st, "MYCustomLoggerRepo");

            //logger.InitializeLogger("ClassLibrary1");

            logger.InitializeLoggerWithDynamicFile("MYCustomLogger", "MYCustomLogFile");
            logger.LogInfo(LogLevelWrapper.DEBUG, "MY log", "DEBUG 1 {0}--->{1}", new object[] { "firstArg", "SecondArg" });
            logger.changeConfiguration("MYCustomLoggerRepo");
            logger.LogInfo(LogLevelWrapper.ERROR, "MY log", "DEBU 2 {0}--->{1}", new object[] { "firstArg", "SecondArg" });

            //st = File.OpenRead(@"C:\Users\tarun.tank\source\repos\log\VerifyLogging\log4net.config");
            //CustomLogger loggerOther = new CustomLogger(st, "OtherCustomLoggerRepo");
            //loggerOther.InitializeLoggerWithDynamicFile("OtherCustomLogger", "OtherCustomLoggerFile");
            //loggerOther.LogInfo(LogLevelWrapper.ERROR, "Other log", " {0}--->{1}", new object[] { "firstArg", "SecondArg" });


            //logger.CloseRepository();
            //loggerOther.CloseRepository();


            //st = File.OpenRead(@"C:\Users\tarun.tank\source\repos\log\VerifyLogging\log4net.config");
            //CustomLogger loggerSeparate = new CustomLogger(st, "SeparateCustomLoggerRepo");
            //loggerSeparate.InitializeLoggerWithDynamicFile("SeparateCustomLogger", "SeparateCustomLoggerFile");
            //loggerSeparate.LogInfo(LogLevelWrapper.ERROR, "Separate log", " {0}--->{1}", new object[] { "firstArg", "SecondArg" });


            //logger.LogInfo(LogLevelWrapper.WARN, "MY log WARN log without format");
            //loggerOther.LogInfo(LogLevelWrapper.WARN, "Other log WARN log without format");
            //loggerSeparate.LogInfo(LogLevelWrapper.WARN, "Separate log WARN log without format");


            //logger.LogInfo(LogLevelWrapper.ERROR, "ERROR log format msg WITHOUT EX", " {0}--->{1}", new object[] { "firstArg", "SecondArg" });
            //logger.LogInfo(LogLevelWrapper.ERROR, "ERROR log without format msg WITHOUT EX");
            //logger.LogInfo(LogLevelWrapper.ERROR, new NullReferenceException(), "ERROR log format msg", " {0}--->{1}", new object[] { "firstArg", "SecondArg" });
            //logger.LogInfo(LogLevelWrapper.ERROR, new NullReferenceException(), "ERROR log without format msg");
            Console.WriteLine();
        }
Пример #2
0
        public static void Main(string[] args)
        {
            RegisterServices();

            List <Airport> airports = new List <Airport>();

            serializeBLL = serviceProvider.GetService <IDataSerializeBLL>();
            var dataProcessor = serviceProvider.GetService <IDataProcessor>();
            var serviceBLL    = serviceProvider.GetService <IServiceBLL>();
            var fileParser    = serviceProvider.GetService <IFileService>();

            SeedDataToDb(airports);

            if (serviceBLL.SerializedFilesExist())
            {
                airports = dataProcessor.ProccessData();
            }
            else
            {
                var timeZoneAirports = fileParser.ProccessJsonFile <TimeZoneInformation>(PathToJsonFile);

                int rowsIgnored = 0;
                airports = dataProcessor.ProccessFile(PathToDatFile, timeZoneAirports, ref rowsIgnored);

                ICustomLogger logger = new CustomLogger();
                logger.LogInfo($"Rows ignored: {rowsIgnored}");

                userInterface.Write($"{airports.Count} entries avavailable");

                SerializeAllData(airports);
                userInterface.Write("Serialization completed");
            }



            OutputSeparationLine();
            OutputAllCountriesWithNumberOfAirportsThenHave(airports);

            OutputSeparationLine();
            CityWithMostAirports(airports);

            OutputSeparationLine();
            DisplayAirportInfoByIATACode(airports);

            OutputSeparationLine();
            ClosestAirportByCoordinates(airports);

            DisposeServices();

            userInterface.ReadKey();
        }