Skip to content

Commit

Permalink
Update log level
Browse files Browse the repository at this point in the history
  • Loading branch information
fahminlb33 committed Oct 16, 2021
1 parent 9553cf3 commit 45ca151
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/KFlearning.App/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ internal static class Program
[STAThread]
static void Main()
{
//try
//{
try
{
using var mutex = new Mutex(true, MutexName);
if (!mutex.WaitOne(MutexTimeout))
{
Expand Down Expand Up @@ -73,21 +73,25 @@ static void Main()
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(Container.GetRequiredService<KFlearningApplicationContext>());
//}
//catch (Exception e)
//{
// Log.Fatal("Application shutdown unexpectedly", e);
// Log.CloseAndFlush();

// MessageBox.Show(MessagesText.FatalShutdown, MessagesText.AppName,
// MessageBoxButtons.OK, MessageBoxIcon.Error);
//}
}
catch (Exception e)
{
Log.Fatal("Application shutdown unexpectedly", e);
Log.CloseAndFlush();

MessageBox.Show(MessagesText.FatalShutdown, MessagesText.AppName,
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

private static void RegisterLogger()
{
Log.Logger = new LoggerConfiguration()
#if DEBUG
.MinimumLevel.Debug()
#else
.MinimumLevel.Information()
#endif
.WriteTo.File("logs/kflearning-.txt", rollingInterval: RollingInterval.Day)
.CreateLogger();
}
Expand Down

0 comments on commit 45ca151

Please sign in to comment.