forked from sim0n00ps/OF-DL
More logging tweaks
This commit is contained in:
parent
f40bd0527b
commit
0cfac356c5
@ -117,7 +117,7 @@ public class Program
|
|||||||
.Enrich.WithProperty("StartTime", $"{DateTime.Now:yyyy-MM-dd HH:mm:ss} ")
|
.Enrich.WithProperty("StartTime", $"{DateTime.Now:yyyy-MM-dd HH:mm:ss} ")
|
||||||
.Enrich.WithProperty("MachineName", Environment.MachineName)
|
.Enrich.WithProperty("MachineName", Environment.MachineName)
|
||||||
.MinimumLevel.ControlledBy(levelSwitch)
|
.MinimumLevel.ControlledBy(levelSwitch)
|
||||||
.WriteTo.File("logs/OFDL.txt", rollingInterval: RollingInterval.Day)
|
.WriteTo.File("logs/OFDL.txt", rollingInterval: RollingInterval.Day, restrictedToMinimumLevel: LogEventLevel.Error)
|
||||||
.WriteTo.Seq("https://seq.cajetan.dk")
|
.WriteTo.Seq("https://seq.cajetan.dk")
|
||||||
.CreateLogger();
|
.CreateLogger();
|
||||||
|
|
||||||
@ -986,10 +986,12 @@ public class Program
|
|||||||
|
|
||||||
using (LogContext.PushProperty("Username", username))
|
using (LogContext.PushProperty("Username", username))
|
||||||
using (LogContext.PushProperty("UserId", userId))
|
using (LogContext.PushProperty("UserId", userId))
|
||||||
|
using (LogContext.PushProperty("UserNum", prevValue+1))
|
||||||
|
using (LogContext.PushProperty("UserTotal", users.Count))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Log.Information("Updating User Info for for: {Username:l}");
|
Log.Information("[{UserNum:0} of {UserTotal}] Updating User Info for for: {Username:l}");
|
||||||
User? user_info = await m_ApiHelper.GetUserInfo(username, $"/users/{username}");
|
User? user_info = await m_ApiHelper.GetUserInfo(username, $"/users/{username}");
|
||||||
await dbHelper.UpdateUserInfo(username, user_info);
|
await dbHelper.UpdateUserInfo(username, user_info);
|
||||||
|
|
||||||
@ -997,7 +999,7 @@ public class Program
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.Warning(ex, "Failed to update User Info for: {Username:l}");
|
Log.Warning(ex, "[{UserNum:0} of {UserTotal}] Failed to update User Info for: {Username:l}");
|
||||||
AnsiConsole.Markup($"[red]Failed to update User Info for '{username}'\n[/]");
|
AnsiConsole.Markup($"[red]Failed to update User Info for '{username}'\n[/]");
|
||||||
|
|
||||||
updateTask.Description = $"{description} - FAILED: {ex.Message}";
|
updateTask.Description = $"{description} - FAILED: {ex.Message}";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user