-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
953e14f
commit a367d54
Showing
8 changed files
with
161 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using System.IO; | ||
|
||
namespace ScriptSharp; | ||
|
||
public sealed class LogSingleton | ||
{ | ||
private static LogSingleton _instance; | ||
private static readonly object Padlock = new(); | ||
|
||
|
||
private LogSingleton() | ||
{ | ||
} | ||
|
||
public static LogSingleton Get | ||
{ | ||
get | ||
{ | ||
if (_instance != null) return _instance; | ||
lock (Padlock) | ||
{ | ||
_instance ??= new LogSingleton(); | ||
} | ||
|
||
return _instance; | ||
} | ||
} | ||
|
||
public void LogAndWriteLine(string message) | ||
{ | ||
Console.WriteLine(message); | ||
using StreamWriter writer = new(Config.logFilePath, true); | ||
writer.WriteLine($"{DateTime.Now}: {message}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.