forked from ddrilling/AsbCloudServer
BackgroundWorkDto add progress to default state message/
This commit is contained in:
parent
552553bb64
commit
4f45cfc1dd
@ -172,7 +172,7 @@ namespace AsbCloudApp.Data
|
||||
if (progress.HasValue)
|
||||
CurrentState.Progress = progress.Value;
|
||||
|
||||
Trace.TraceInformation($"{WorkNameForTrace} state: {newState}");
|
||||
Trace.TraceInformation($"{WorkNameForTrace} state: {newState} [{100*progress:#}%]");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -19,7 +19,7 @@ public class BackgroundWorker : BackgroundService
|
||||
public WorkStore WorkStore { get; } = new WorkStore();
|
||||
public Work? CurrentWork;
|
||||
|
||||
public Exception? MainLoopLastException { get; private set; } = null;
|
||||
public string MainLoopLastException { get; private set; } = string.Empty;
|
||||
|
||||
public BackgroundWorker(IServiceProvider serviceProvider)
|
||||
{
|
||||
@ -54,14 +54,13 @@ public class BackgroundWorker : BackgroundService
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MainLoopLastException = ex;
|
||||
var mainLoopLastException = $"BackgroundWorker " +
|
||||
MainLoopLastException = $"BackgroundWorker " +
|
||||
$"MainLoopLastException: \r\n" +
|
||||
$"date: {DateTime.Now:O}\r\n" +
|
||||
$"message: {ex.Message}\r\n" +
|
||||
$"inner: {ex.InnerException?.Message}\r\n" +
|
||||
$"stackTrace: {ex.StackTrace}";
|
||||
Trace.TraceError(mainLoopLastException);
|
||||
Trace.TraceError(MainLoopLastException);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user