public void Refresh() { if (Configuration == null || !Configuration.IsValid()) { return; } if (Instance != null) { return; } Enabled = true; CaptureUnityMessages(); _reportLimitWatcher = new ReportLimitWatcher(Convert.ToUInt32(Configuration.ReportPerMin)); BacktraceApi = new BacktraceApi( credentials: new BacktraceCredentials(Configuration.GetValidServerUrl()), #if UNITY_2018_4_OR_NEWER ignoreSslValidation: Configuration.IgnoreSslValidation #else ignoreSslValidation: false #endif ); BacktraceApi.EnablePerformanceStatistics = Configuration.PerformanceStatistics; if (!Configuration.DestroyOnLoad) { DontDestroyOnLoad(gameObject); _instance = this; } if (Configuration.Enabled) { Database = GetComponent <BacktraceDatabase>(); if (Database != null) { Database.Reload(); Database.SetApi(BacktraceApi); Database.SetReportWatcher(_reportLimitWatcher); } } _nativeClient = NativeClientFactory.GetNativeClient(Configuration, name); if (_nativeClient != null) { foreach (var attribute in _clientAttributes) { _nativeClient.SetAttribute(attribute.Key, attribute.Value); } } if (Configuration.SendUnhandledGameCrashesOnGameStartup && isActiveAndEnabled) { var nativeCrashUplaoder = new NativeCrashUploader(); nativeCrashUplaoder.SetBacktraceApi(BacktraceApi); StartCoroutine(nativeCrashUplaoder.SendUnhandledGameCrashesOnGameStartup(_previousSessionAttachments)); } }
private void Awake() { Configuration = GetComponent <BacktraceClient>().Configuration; if (Configuration == null || !Configuration.IsValid()) { Debug.LogWarning("Configuration doesn't exists or provided serverurl/token are invalid"); _enable = false; return; } DatabaseSettings = new BacktraceDatabaseSettings(Configuration); if (DatabaseSettings == null) { _enable = false; return; } if (Configuration.CreateDatabase) { Directory.CreateDirectory(Configuration.DatabasePath); } _enable = Configuration.Enabled && BacktraceConfiguration.ValidateDatabasePath(Configuration.DatabasePath); if (!_enable) { return; } _lastConnection = Time.time; BacktraceDatabaseContext = new BacktraceDatabaseContext(DatabasePath, DatabaseSettings.RetryLimit, DatabaseSettings.RetryOrder); BacktraceDatabaseFileContext = new BacktraceDatabaseFileContext(DatabasePath, DatabaseSettings.MaxDatabaseSize, DatabaseSettings.MaxRecordCount); BacktraceApi = new BacktraceApi(Configuration.ToCredentials(), Convert.ToUInt32(Configuration.ReportPerMin)); }
/// <summary> /// Reload Backtrace database configuration. Reloading configuration is required, when you change /// BacktraceDatabase configuration options. /// </summary> public void Reload() { // validate configuration if (Configuration == null) { Configuration = GetComponent <BacktraceClient>().Configuration; } if (Configuration == null || !Configuration.IsValid()) { Debug.LogWarning("Configuration doesn't exists or provided serverurl/token are invalid"); Enable = false; return; } //setup database object DatabaseSettings = new BacktraceDatabaseSettings(Configuration); Enable = Configuration.Enabled && BacktraceConfiguration.ValidateDatabasePath(Configuration.DatabasePath); if (!Enable) { Debug.LogWarning("Cannot initialize database - invalid database configuration. Database is disabled"); return; } CreateDatabaseDirectory(); SetupMultisceneSupport(); _lastConnection = Time.time; //Setup database context BacktraceDatabaseContext = new BacktraceDatabaseContext(DatabasePath, DatabaseSettings.RetryLimit, DatabaseSettings.RetryOrder, DatabaseSettings.DeduplicationStrategy); BacktraceDatabaseFileContext = new BacktraceDatabaseFileContext(DatabasePath, DatabaseSettings.MaxDatabaseSize, DatabaseSettings.MaxRecordCount); BacktraceApi = new BacktraceApi(Configuration.ToCredentials()); _reportLimitWatcher = new ReportLimitWatcher(Convert.ToUInt32(Configuration.ReportPerMin)); }
public void Refresh() { if (Configuration == null || !Configuration.IsValid()) { return; } Enabled = true; Annotations.GameObjectDepth = Configuration.GameObjectDepth; HandleUnhandledExceptions(); _reportLimitWatcher = new ReportLimitWatcher(Convert.ToUInt32(Configuration.ReportPerMin)); #if UNITY_2018_4_OR_NEWER BacktraceApi = new BacktraceApi( credentials: new BacktraceCredentials(Configuration.GetValidServerUrl()), ignoreSslValidation: Configuration.IgnoreSslValidation); #else BacktraceApi = new BacktraceApi(new BacktraceCredentials(Configuration.GetValidServerUrl())); #endif if (Configuration.DestroyOnLoad == false) { DontDestroyOnLoad(gameObject); _instance = this; } Database = GetComponent <BacktraceDatabase>(); if (Database == null) { return; } Database.Reload(); Database.SetApi(BacktraceApi); Database.SetReportWatcher(_reportLimitWatcher); }
private void Awake() { Database = GetComponent <BacktraceDatabase>(); if (Configuration == null || !Configuration.IsValid()) { Debug.LogWarning("Configuration doesn't exists or provided serverurl/token are invalid"); return; } if (Configuration.HandleUnhandledExceptions) { HandleUnhandledExceptions(); } BacktraceApi = new BacktraceApi( credentials: new BacktraceCredentials(Configuration.ServerUrl, Configuration.Token), reportPerMin: Convert.ToUInt32(Configuration.ReportPerMin)); Database?.SetApi(BacktraceApi); }
/// <summary> /// Reload Backtrace database configuration. Reloading configuration is required, when you change /// BacktraceDatabase configuration options. /// </summary> public void Reload() { // validate configuration if (Configuration == null) { Configuration = GetComponent <BacktraceClient>().Configuration; } if (Instance != null) { return; } if (Configuration == null || !Configuration.IsValid()) { Enable = false; return; } #if UNITY_SWITCH Enable = false; #else Enable = Configuration.Enabled && InitializeDatabasePaths(); #endif if (!Enable) { if (Configuration.Enabled) { Debug.LogWarning("Cannot initialize database - invalid path to database. Database is disabled"); } return; } //setup database object DatabaseSettings = new BacktraceDatabaseSettings(DatabasePath, Configuration); SetupMultisceneSupport(); _lastConnection = Time.time; LastFrameTime = Time.time; //Setup database context BacktraceDatabaseContext = new BacktraceDatabaseContext(DatabaseSettings); BacktraceDatabaseFileContext = new BacktraceDatabaseFileContext(DatabaseSettings.DatabasePath, DatabaseSettings.MaxDatabaseSize, DatabaseSettings.MaxRecordCount); BacktraceApi = new BacktraceApi(Configuration.ToCredentials()); _reportLimitWatcher = new ReportLimitWatcher(Convert.ToUInt32(Configuration.ReportPerMin)); }
public void Refresh() { if (Configuration == null || !Configuration.IsValid()) { return; } if (Instance != null) { return; } Enabled = true; _current = Thread.CurrentThread; CaptureUnityMessages(); _reportLimitWatcher = new ReportLimitWatcher(Convert.ToUInt32(Configuration.ReportPerMin)); _clientReportAttachments = Configuration.GetAttachmentPaths(); BacktraceApi = new BacktraceApi( credentials: new BacktraceCredentials(Configuration.GetValidServerUrl()), #if UNITY_2018_4_OR_NEWER ignoreSslValidation: Configuration.IgnoreSslValidation #else ignoreSslValidation: false #endif ); BacktraceApi.EnablePerformanceStatistics = Configuration.PerformanceStatistics; if (!Configuration.DestroyOnLoad) { DontDestroyOnLoad(gameObject); _instance = this; } var nativeAttachments = _clientReportAttachments.ToList() .Where(n => !string.IsNullOrEmpty(n)) .OrderBy(System.IO.Path.GetFileName, StringComparer.InvariantCultureIgnoreCase).ToList(); if (Configuration.Enabled) { Database = GetComponent <BacktraceDatabase>(); if (Database != null) { Database.Reload(); Database.SetApi(BacktraceApi); Database.SetReportWatcher(_reportLimitWatcher); if (Database.Breadcrumbs != null) { nativeAttachments.Add(Database.Breadcrumbs.GetBreadcrumbLogPath()); } _nativeClient = NativeClientFactory.CreateNativeClient(Configuration, name, AttributeProvider.GenerateAttributes(false), nativeAttachments); Database.EnableBreadcrumbsSupport(); } } AttributeProvider.AddDynamicAttributeProvider(_nativeClient); if (Configuration.SendUnhandledGameCrashesOnGameStartup && isActiveAndEnabled) { var nativeCrashUplaoder = new NativeCrashUploader(); nativeCrashUplaoder.SetBacktraceApi(BacktraceApi); StartCoroutine(nativeCrashUplaoder.SendUnhandledGameCrashesOnGameStartup()); } #if !UNITY_WEBGL EnableMetrics(false); #endif }