Exemple #1
0
        public static void Initialize()
        {
            try
            {
                // Required for logging
                SMA.Core.SharedConfiguration = new ConfigurationService(SMAFileSystem.SharedConfigDir);

                SMA.Core.Logger = LoggerFactory.Create(SMAConst.Name, SMA.Core.SharedConfiguration, SentryEx.LogToSentry);

#pragma warning disable CS0436 // Type conflicts with imported type
                Logger.ReloadAnotarLogger(typeof(ModuleInitializer));
#pragma warning restore CS0436 // Type conflicts with imported type

                // ReSharper disable once RedundantNameQualifier
                var appType = typeof(SuperMemoAssistant.App);
                SMA.Core.SMAVersion = appType.GetAssemblyVersion();

                LogTo.Information("SuperMemo Assistant version {SMAVersion} starting.", SMA.Core.SMAVersion);

                SentryInstance = SentryEx.Initialize("https://[email protected]/5506799", SMA.Core.SMAVersion);

                SMA.Core.Configuration   = new ConfigurationService(SMAFileSystem.ConfigDir.Combine("Core"));
                SMA.Core.KeyboardHotKey  = KeyboardHookService.Instance;
                SMA.Core.HotKeyManager   = HotKeyManager.Instance.Initialize(SMA.Core.Configuration, SMA.Core.KeyboardHotKey);
                SMA.Core.NotificationMgr = NotificationManager.Instance;
                SMA.Core.SMA             = new SMA.SMA();

                object tmp;
                tmp = LayoutManager.Instance;
                tmp = SMAPluginManager.Instance;
            }
            catch (SMAException ex)
            {
                LogTo.Warning(ex, "Error during SuperMemoAssistant Initialize().");
                File.WriteAllText(SMAFileSystem.TempErrorLog.FullPath, $"Error during SuperMemoAssistant Initialize(): {ex}");
            }
            catch (Exception ex)
            {
                LogTo.Error(ex, "Exception thrown during SuperMemoAssistant module Initialize().");
                File.WriteAllText(SMAFileSystem.TempErrorLog.FullPath, $"Exception thrown during SuperMemoAssistant Initialize(): {ex}");
            }
        }
Exemple #2
0
        private static void SetupLogger(string ext)
        {
            //
            // Logs

            ext = ext.Replace("chrome-extension://", "chrome-").Replace("/", "")
                  .Replace("{", "firefox-").Replace("}", "");

            _logger = LoggerFactory.Create(
                typeof(Program).GetAssemblyName() + $"_{ext}",
                new ConfigurationService(SMAFileSystem.SharedConfigDir),
                l => l.LogToSentry());

            //
            // Sentry

            var hostType    = typeof(Program);
            var releaseName = hostType.GetAssemblyVersion();

            _sentry = SentryEx.Initialize("https://[email protected]/5506802", releaseName);
        }
Exemple #3
0
        public static void Initialize()
        {
            try
            {
                // Required for logging
                SuperMemoAssistant.SMA.Core.SharedConfiguration = new ConfigurationService(SMAFileSystem.SharedConfigDir);

                SuperMemoAssistant.SMA.Core.Logger = LoggerFactory.Create(SMAConst.Name, SuperMemoAssistant.SMA.Core.SharedConfiguration, Services.Sentry.SentryEx.LogToSentry);

#pragma warning disable CS0436 // Type conflicts with imported type
                Logger.ReloadAnotarLogger(typeof(SuperMemoAssistant.ModuleInitializer));
#pragma warning restore CS0436 // Type conflicts with imported type

                // ReSharper disable once RedundantNameQualifier
                var appType = typeof(SuperMemoAssistant.App);
                SuperMemoAssistant.SMA.Core.SMAVersion = appType.GetAssemblyVersion();

                var releaseName = $"SuperMemoAssistant@{SuperMemoAssistant.SMA.Core.SMAVersion}";

                SentryInstance = SentryEx.Initialize("https://[email protected]/1362046", releaseName);

                SuperMemoAssistant.SMA.Core.Configuration  = new ConfigurationService(SMAFileSystem.ConfigDir.Combine("Core"));
                SuperMemoAssistant.SMA.Core.KeyboardHotKey = KeyboardHookService.Instance;
                SuperMemoAssistant.SMA.Core.HotKeyManager  = HotKeyManager.Instance.Initialize(SuperMemoAssistant.SMA.Core.Configuration, SuperMemoAssistant.SMA.Core.KeyboardHotKey);
                SuperMemoAssistant.SMA.Core.SMA            = new SMA.SMA();

                object tmp;
                tmp = LayoutManager.Instance;
                tmp = SMAPluginManager.Instance;
            }
            catch (SMAException ex)
            {
                LogTo.Warning(ex, "Error during SuperMemoAssistant Initialize().");
            }
            catch (Exception ex)
            {
                LogTo.Error(ex, "Exception thrown during SuperMemoAssistant module Initialize().");
            }
        }