Skip to content

Commit

Permalink
Fix log
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreOlivierBrillant committed Oct 17, 2024
1 parent 6e978b0 commit 0c5b77d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
5 changes: 1 addition & 4 deletions scriptsharp/ScriptSharp/LogSingleton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ public sealed class LogSingleton
private static LogSingleton _instance;
private static readonly object Padlock = new object();

private StreamWriter writer;

private LogSingleton()
{
Initialize();
Expand All @@ -19,8 +17,6 @@ private void Initialize()
{
Directory.CreateDirectory(Config.LogPath);
File.WriteAllText(Config.LogFilePath, string.Empty);
writer = new(Config.LogFilePath, true);
AppDomain.CurrentDomain.ProcessExit += (s, e) => writer.Close();
}

public static LogSingleton Get
Expand All @@ -39,6 +35,7 @@ public static LogSingleton Get

public void LogAndWriteLine(string message)
{
using StreamWriter writer = new(Config.LogFilePath, true);
Console.WriteLine(message);
writer.WriteLine($"{DateTime.Now}: {message}");
}
Expand Down
1 change: 1 addition & 0 deletions scriptsharp/ScriptSharp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ static class Program

private static async Task Main()
{
UtilsFirebase.InstallFlutterFire();
//LogSingleton.Get.LogAndWriteLine("yo");
//TestDebug();
Directory.SetCurrentDirectory(Environment.GetFolderPath(Environment.SpecialFolder.Desktop));
Expand Down

0 comments on commit 0c5b77d

Please sign in to comment.