Пример #1
0
        public SentryLogger(QsorBaseGame game)
        {
            if (DebugUtils.IsDebugBuild)
            {
                return;
            }

            var sentryOptions = new SentryOptions
            {
                Dsn     = new Dsn("https://[email protected]/5193034"),
                Release = QsorBaseGame.Version
            };

            _sentry = new SentryClient(sentryOptions);
            var sentryScope = new Scope(sentryOptions);

            Exception lastException = null;

            Logger.NewEntry += async entry =>
            {
                if (entry.Level < LogLevel.Verbose)
                {
                    return;
                }

                var exception = entry.Exception;

                if (exception != null)
                {
                    if (lastException != null && // We shouldn't resubmit the same exception
                        lastException.Message == exception.Message &&
                        exception.StackTrace?.StartsWith(lastException.StackTrace ?? string.Empty) == true)
                    {
                        return;
                    }

                    _sentry.CaptureEvent(new SentryEvent(exception)
                    {
                        Message = entry.Message
                    }, sentryScope);
                    lastException = exception;
                }
                else
                {
                    sentryScope.AddBreadcrumb(DateTimeOffset.Now, entry.Message, entry.Target.ToString(), "qsor-logger");
                }
            };
        }
Пример #2
0
 public GlobalKeyBindingInputHandler(QsorBaseGame game)
     : base(matchingMode: KeyCombinationMatchingMode.Modifiers)
 {
     _handler = game;
 }