コード例 #1
0
        public StackEngine(StackGame game, IServiceProvider services, InputProvider input, GameSettings gameSettings)
        {
            GameSettings = gameSettings;
            Services     = services;
            gameSettings.SetCulture();

            var ConsoleLogHandler = new ConsoleLogHandler(Console);

            EngineContent = new ContentLoader(Services);
            Renderer      = new Renderer(Services, EngineContent, game.VirtualResolution, gameSettings.GetTargetResolution(game.VirtualResolution), gameSettings.Bloom);

            Game = game;

            Console = new Console(this);
            ConsoleLogHandler.Console = Console;
            _Paused = true;

            InputProvider = input;

            if (InputProvider != null)
            {
                InputProvider.DisplaySettings = Renderer.DisplaySettings;
            }

            EngineVariables.EnableGUI = true;
            Game.Start(this);
        }
コード例 #2
0
        LoggerManager()
        {
            // Initialize Loggers
            ConsoleLogHandler  cHandler = new ConsoleLogHandler();
            FileLogHandler     fHandler = new FileLogHandler(Mowbly.LogFile);
            DatabaseLogHandler dHandler = new DatabaseLogHandler(
                Mowbly.GetProperty <string>(Constants.PROPERTY_LOGS_DB),
                float.Parse(Mowbly.GetProperty <string>(Constants.PROPERTY_LOGS_DB_VERSION)),
                Mowbly.LogDatabaseFile,
                System.String.Empty);

            // System Logger
            Logger systemLogger = GetLogger(TYPE_SYSTEM_LOGGER);

            systemLogger.AddHandler(fHandler);
            systemLogger.AddHandler(dHandler);

            // User Logger
            Logger userLogger = GetLogger(TYPE_USER_LOGGER);

            userLogger.AddHandler(fHandler);
            userLogger.AddHandler(dHandler);

#if DEBUG
            systemLogger.AddHandler(cHandler);
            userLogger.AddHandler(cHandler);
#endif
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: WhaleKit/space-station-14
        private static void SetupLogging()
        {
            var mgr     = IoCManager.Resolve <ILogManager>();
            var handler = new ConsoleLogHandler();

            mgr.RootSawmill.AddHandler(handler);
            mgr.GetSawmill("res.typecheck").Level = LogLevel.Info;
        }
コード例 #4
0
        internal static void SetupLogging(ILogManager logManager, Func <ILogHandler> logHandlerFactory)
        {
            logManager.RootSawmill.AddHandler(logHandlerFactory());

            logManager.GetSawmill("res.typecheck").Level         = LogLevel.Info;
            logManager.GetSawmill("res.tex").Level               = LogLevel.Info;
            logManager.GetSawmill("console").Level               = LogLevel.Info;
            logManager.GetSawmill("go.sys").Level                = LogLevel.Info;
            logManager.GetSawmill("ogl.debug.performance").Level = LogLevel.Fatal;
            // Stupid nvidia driver spams buffer info on DebugTypeOther every time you re-allocate a buffer.
            logManager.GetSawmill("ogl.debug.other").Level = LogLevel.Warning;
            logManager.GetSawmill("gdparse").Level         = LogLevel.Error;
            logManager.GetSawmill("discord").Level         = LogLevel.Warning;
            logManager.GetSawmill("net.predict").Level     = LogLevel.Info;
            logManager.GetSawmill("szr").Level             = LogLevel.Info;

#if DEBUG_ONLY_FCE_INFO
#if DEBUG_ONLY_FCE_LOG
            var fce = logManager.GetSawmill("fce");
#endif
            AppDomain.CurrentDomain.FirstChanceException += (sender, args) =>
            {
                // TODO: record FCE stats
#if DEBUG_ONLY_FCE_LOG
                fce.Fatal(message);
#endif
            }
#endif

            var uh = logManager.GetSawmill("unhandled");
            AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
            {
                var message = ((Exception)args.ExceptionObject).ToString();
                uh.Log(args.IsTerminating ? LogLevel.Fatal : LogLevel.Error, message);
            };

            var uo = logManager.GetSawmill("unobserved");
            TaskScheduler.UnobservedTaskException += (sender, args) =>
            {
                uo.Error(args.Exception !.ToString());
#if EXCEPTION_TOLERANCE
                args.SetObserved(); // don't crash
#endif
            };

#if !DEBUG
            ConsoleLogHandler.TryDetachFromConsoleWindow();
#endif
        }
コード例 #5
0
        internal static void SetupLogging()
        {
            if (OperatingSystem.IsWindows())
            {
#if WINDOWS_USE_UTF8_CONSOLE
                System.Console.OutputEncoding = Encoding.UTF8;
#else
                System.Console.OutputEncoding = Encoding.Unicode;
#endif
            }

            var mgr     = IoCManager.Resolve <ILogManager>();
            var handler = new ConsoleLogHandler();
            mgr.RootSawmill.AddHandler(handler);
            mgr.GetSawmill("res.typecheck").Level = LogLevel.Info;
            mgr.GetSawmill("go.sys").Level        = LogLevel.Info;
            mgr.GetSawmill("loc").Level           = LogLevel.Error;
            // mgr.GetSawmill("szr").Level = LogLevel.Info;

#if DEBUG_ONLY_FCE_INFO
#if DEBUG_ONLY_FCE_LOG
            var fce = mgr.GetSawmill("fce");
#endif
            AppDomain.CurrentDomain.FirstChanceException += (sender, args) =>
            {
                // TODO: record FCE stats
#if DEBUG_ONLY_FCE_LOG
                fce.Fatal(message);
#endif
            }
#endif

            var uh = mgr.GetSawmill("unhandled");
            AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
            {
                var message = ((Exception)args.ExceptionObject).ToString();
                uh.Log(args.IsTerminating ? LogLevel.Fatal : LogLevel.Error, message);
            };

            var uo = mgr.GetSawmill("unobserved");
            TaskScheduler.UnobservedTaskException += (sender, args) =>
            {
                uo.Error(args.Exception !.ToString());
#if EXCEPTION_TOLERANCE
                args.SetObserved(); // don't crash
#endif
            };
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: Xamarui/LocationTracker
        static void Main(string[] args)
        {
            var storageLocation = @"d:\test.log";
            if (args.Length > 0)
            {
                storageLocation = args[0];
            }
            var start = DateTime.Now;

            EventPublisher<TrackedObject> publisher = null; // will be initialized below, after ring buffer created
            var simulator = new Simulator(ObjectsCount, obj =>
            {
                publisher.PublishEvent((entry, sequenceNo) =>
                {
                    entry.Latitude = obj.Latitude;
                    entry.Longitude = obj.Longitude;
                    entry.Id = obj.Id;
                    return entry;
                });
            });

            var disruptor = new Disruptor.Dsl.Disruptor<TrackedObject>(() => new TrackedObject(), RingBufferSize, TaskScheduler.Default);
            
            var distanceHandler = new DistanceHandler();
            var aknowledgementHandler = new AknowledgementHandler(simulator);
            var consoleLogHandler = new ConsoleLogHandler();
            using (var persistHandler = new ObjectPersistHandler(storageLocation))
            {
                disruptor.HandleEventsWith(persistHandler)
                         .Then(consoleLogHandler, distanceHandler)
                         .Then(aknowledgementHandler);
                
                var ringBuffer = disruptor.Start();
                publisher = new EventPublisher<TrackedObject>(ringBuffer);
                
                simulator.PublishStartPositions();
                
                Thread.Sleep(10000);

                simulator.Stop();
                
                disruptor.Shutdown();
            }
            Console.WriteLine(distanceHandler.GetSummary());
            Console.WriteLine("Processed {0} events. Speed: {1:#.##} events per second.", simulator.MoveCount, simulator.MoveCount / (DateTime.Now - start).TotalSeconds);
            Console.ReadKey();
        }