Example #1
0
        public void Info()
        {
            const string message = "Info message";
            var          level   = LoggerLevel.Info;

            logger.Info(message);

            ValidateCall(level, message, null);
        }
Example #2
0
        public void Info()
        {
            string      message   = "Info message";
            LoggerLevel level     = LoggerLevel.Info;
            Exception   exception = null;

            logger.Info(message);

            ValidateCall(level, message, exception);
        }
Example #3
0
        public IEnumerator Run()
        {
            PostPatchLoader.Instance.databaseConfigs = null;

            if (!Directory.Exists(logsDirPath))
            {
                Directory.CreateDirectory(logsDirPath);
            }

            kspLogger.Info("Patching started on a new thread, all output will be directed to " + logPath);

            MessageQueue <ILogMessage> mmLogQueue = new MessageQueue <ILogMessage>();
            QueueLogRunner             logRunner  = new QueueLogRunner(mmLogQueue);
            ITaskStatus loggingThreadStatus       = BackgroundTask.Start(delegate
            {
                using StreamLogger streamLogger = new StreamLogger(new FileStream(logPath, FileMode.Create));
                streamLogger.Info("Log started at " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                logRunner.Run(streamLogger);
                streamLogger.Info("Done!");
            });
Example #4
0
        private static void Main(String[] args)
        {
            using (var logger = new StreamLogger(new StreamWriter(DateTime.Now.Date.ToString("dd/MM/yyyy") + ".log")
            {
                AutoFlush = true
            }))
            {
                var parser = new FluentCommandLineParser();

                String exe  = null;
                String path = null;

                parser.Setup <String>("p", longOption: "path")
                .Callback(e => path = e);
                parser.Setup <String>("e", longOption: "exe")
                .Callback(e => exe = e);

                parser.Parse(args);

                logger.Info(exe);

                ITester tester = new Tester(
                    logger,
                    new ZipCollectorTests(
                        logger,
                        path,
                        new String[] { "228", "123" }

                        ),
                    new CheckAllTestsLauncher
                    (
                        new OneTestRunner(
                            logger,
                            new FullStreamComparer(),
                            exe
                            )
                    )
                    );

                var result = tester.Run();

                List <TestResult> l = new List <TestResult>(result);

                IPostman postman = new GmailPostman(logger, "*****@*****.**", "123456vkr^^", "TesterSfedu");

                postman.Send("*****@*****.**", "Test", l);
            }
        }
Example #5
0
        public IEnumerator Run()
        {
            PostPatchLoader.Instance.databaseConfigs = null;

            if (!Directory.Exists(logsDirPath))
            {
                Directory.CreateDirectory(logsDirPath);
            }

            kspLogger.Info("Patching started on a new thread, all output will be directed to " + logPath);

            MessageQueue <ILogMessage> mmLogQueue = new MessageQueue <ILogMessage>();
            QueueLogRunner             logRunner  = new QueueLogRunner(mmLogQueue);
            ITaskStatus loggingThreadStatus       = BackgroundTask.Start(delegate
            {
                using (StreamLogger streamLogger = new StreamLogger(new FileStream(logPath, FileMode.Create)))
                {
                    logRunner.Run(streamLogger);
                    streamLogger.Info("Done!");
                }
            });

            // Wait for game database to be initialized for the 2nd time and wait for any plugins to initialize
            yield return(null);

            yield return(null);

            IBasicLogger mmLogger = new QueueLogger(mmLogQueue);

            IEnumerable <ModListGenerator.ModAddedByAssembly> modsAddedByAssemblies = ModListGenerator.GetAdditionalModsFromStaticMethods(mmLogger);

            IEnumerable <IProtoUrlConfig> databaseConfigs = null;

            MMPatchLoader patchLoader = new MMPatchLoader(modsAddedByAssemblies, mmLogger);

            ITaskStatus patchingThreadStatus = BackgroundTask.Start(delegate
            {
                databaseConfigs = patchLoader.Run();
            });

            while (true)
            {
                yield return(null);

                if (!patchingThreadStatus.IsRunning)
                {
                    logRunner.RequestStop();
                }

                Status = patchLoader.status;
                Errors = patchLoader.errors;

                if (!patchingThreadStatus.IsRunning && !loggingThreadStatus.IsRunning)
                {
                    break;
                }
            }

            if (patchingThreadStatus.IsExitedWithError)
            {
                kspLogger.Exception("The patching thread threw an exception", patchingThreadStatus.Exception);
                FatalErrorHandler.HandleFatalError("The patching thread threw an exception");
            }

            if (loggingThreadStatus.IsExitedWithError)
            {
                kspLogger.Exception("The logging thread threw an exception", loggingThreadStatus.Exception);
                FatalErrorHandler.HandleFatalError("The logging thread threw an exception");
            }

            if (databaseConfigs == null)
            {
                kspLogger.Error("The patcher returned a null collection of configs");
                FatalErrorHandler.HandleFatalError("The patcher returned a null collection of configs");
                yield break;
            }

            PostPatchLoader.Instance.databaseConfigs = databaseConfigs;
        }