public static void CheckForUpdates() { try { var updateChecked = WTUpdate.Updater.CheckForUpdate(OSDynamic.GetProductAssembly().ProductName); Log.Debug("App update check success: {UpdateChecked}", updateChecked); } catch (Exception ex) { Log.Warning(ex, "Error occured checking for updates"); } }
internal static void InitializeLogger() { if (Constants.DebugMode) { Constants.LogLevelCloud.MinimumLevel = LogEventLevel.Debug; Constants.LogLevelLocal.MinimumLevel = LogEventLevel.Debug; } Log.Logger = new LoggerConfiguration() .WriteTo.Async(c => c.File($"{Constants.PathLogs}\\{OSDynamic.GetProductAssembly().ProductName}_.log", rollingInterval: RollingInterval.Day, fileSizeLimitBytes: 10000000, rollOnFileSizeLimit: true, outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}", levelSwitch: Constants.LogLevelLocal)) .WriteTo.Async(c => c.Seq("http://dev.wobigtech.net:5341", apiKey: Constants.LogUri, controlLevelSwitch: Constants.LogLevelCloud)) .Enrich.WithCaller() .Enrich.WithThreadName() .Enrich.FromLogContext() .Enrich.WithMachineName() .Enrich.WithEnvironmentUserName() .Enrich.WithProperty("Application", OSDynamic.GetProductAssembly().ProductName) .Enrich.WithProperty("SessionID", Guid.NewGuid()) .Enrich.WithProperty("AppVersion", OSDynamic.GetProductAssembly().AppVersion) .CreateLogger(); ChangeLoggingLevelLocal(); ChangeLoggingLevelCloud(); ChangeLoggingLevelConsole(); Log.Information("==START-STOP== Application Started"); if (Constants.DebugMode) { Log.Information("LogUri is Public1"); } else { Log.Information("LogUri is Public2"); } }
internal static StatusReturn OpenDir(AppFile appFile) { try { if (OSDynamic.GetCurrentOS() == OSPlatform.Windows) { var file = FileType.GetFileType(appFile); OSDynamic.OpenPath(file.Directory); return(StatusReturn.Success); } else { return(StatusReturn.Failure); } } catch (Exception ex) { Log.Error(ex, "Failed to open directory"); Handler.NotifyError(ex, "OpenFolder"); return(StatusReturn.Failure); } }