mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-16 02:01:29 -07:00
Add analytic logging of exceptions
This commit is contained in:
parent
59bcf6fd27
commit
cac081eeb8
@ -107,6 +107,8 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
_showingExceptionDialog = true;
|
_showingExceptionDialog = true;
|
||||||
|
|
||||||
|
SendLog();
|
||||||
|
|
||||||
if (Bootstrapper?.Dialog != null)
|
if (Bootstrapper?.Dialog != null)
|
||||||
{
|
{
|
||||||
if (Bootstrapper.Dialog.TaskbarProgressValue == 0)
|
if (Bootstrapper.Dialog.TaskbarProgressValue == 0)
|
||||||
@ -159,6 +161,24 @@ namespace Bloxstrap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async void SendLog()
|
||||||
|
{
|
||||||
|
if (!Settings.Prop.EnableAnalytics || !IsProductionBuild)
|
||||||
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await HttpClient.PostAsync(
|
||||||
|
$"https://bloxstraplabs.com/metrics/post-exception",
|
||||||
|
new StringContent(Logger.AsDocument)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.WriteException("App::SendLog", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnStartup(StartupEventArgs e)
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
{
|
{
|
||||||
const string LOG_IDENT = "App::OnStartup";
|
const string LOG_IDENT = "App::OnStartup";
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
public bool NoWriteMode = false;
|
public bool NoWriteMode = false;
|
||||||
public string? FileLocation;
|
public string? FileLocation;
|
||||||
|
|
||||||
|
public string AsDocument => String.Join('\n', History);
|
||||||
|
|
||||||
public void Initialize(bool useTempDir = false)
|
public void Initialize(bool useTempDir = false)
|
||||||
{
|
{
|
||||||
const string LOG_IDENT = "Logger::Initialize";
|
const string LOG_IDENT = "Logger::Initialize";
|
||||||
|
@ -30,7 +30,7 @@ namespace Bloxstrap.UI.Elements.Dialogs
|
|||||||
string wikiUrl = $"{repoUrl}/wiki";
|
string wikiUrl = $"{repoUrl}/wiki";
|
||||||
|
|
||||||
string title = HttpUtility.UrlEncode($"[BUG] {exception.GetType()}: {exception.Message}");
|
string title = HttpUtility.UrlEncode($"[BUG] {exception.GetType()}: {exception.Message}");
|
||||||
string log = HttpUtility.UrlEncode(String.Join('\n', App.Logger.History));
|
string log = HttpUtility.UrlEncode(App.Logger.AsDocument);
|
||||||
|
|
||||||
string issueUrl = $"{repoUrl}/issues/new?template=bug_report.yaml&title={title}&log={log}";
|
string issueUrl = $"{repoUrl}/issues/new?template=bug_report.yaml&title={title}&log={log}";
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ namespace Bloxstrap.UI.Elements.Dialogs
|
|||||||
if (App.Logger.Initialized && !String.IsNullOrEmpty(App.Logger.FileLocation))
|
if (App.Logger.Initialized && !String.IsNullOrEmpty(App.Logger.FileLocation))
|
||||||
Utilities.ShellExecute(App.Logger.FileLocation);
|
Utilities.ShellExecute(App.Logger.FileLocation);
|
||||||
else
|
else
|
||||||
Clipboard.SetDataObject(String.Join("\r\n", App.Logger.History));
|
Clipboard.SetDataObject(App.Logger.AsDocument);
|
||||||
};
|
};
|
||||||
|
|
||||||
CloseButton.Click += delegate
|
CloseButton.Click += delegate
|
||||||
|
Loading…
Reference in New Issue
Block a user