Пример #1
0
        public static IHub FromOptions(SentryOptions options)
        {
            options.SetupLogging();

            var dsn = options.Dsn ?? DsnLocator.FindDsnStringOrDisable();

            if (Dsn.IsDisabled(dsn))
            {
                options.DiagnosticLogger?.LogWarning("Init was called but no DSN was provided nor located. Sentry SDK will be disabled.");
                return(DisabledHub.Instance);
            }

            return(new Hub(options));
        }
        public OptionalHub(SentryOptions options)
        {
            options.SetupLogging();

            if (options.Dsn == null)
            {
                if (!Dsn.TryParse(DsnLocator.FindDsnStringOrDisable(), out var dsn))
                {
                    options.DiagnosticLogger?.LogWarning("Init was called but no DSN was provided nor located. Sentry SDK will be disabled.");
                    _hub = DisabledHub.Instance;
                    return;
                }
                options.Dsn = dsn;
            }

            _hub = new Hub(options);
        }