Skip to content

Commit

Permalink
no logging unless file selected
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertvanheusden committed Feb 26, 2025
1 parent 76a0365 commit 254a8b2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ internal enum LogLevel { TRACE, DEBUG, INFO, WARNING, ERRROR, FATAL };

class Log
{
private static string _logfile = "logfile.txt";
private static string _logfile = null;
private static string _disassembly = null;
private static bool _echo = false;
private static int _nr = 0;
Expand Down Expand Up @@ -71,6 +71,9 @@ public static void EmitDisassembly()

public static void DoLog(string what, LogLevel ll)
{
if (_logfile == null)
return;

string output = $"[{_nr} | {_cs:X04}:{_ip:X04}] {ll} " + (ll != LogLevel.TRACE ? "; " : "") + what + Environment.NewLine;

lock(_logging_lock)
Expand All @@ -85,6 +88,9 @@ public static void DoLog(string what, LogLevel ll)

public static void DoLog(string what, bool is_meta = false)
{
if (_logfile == null)
return;

string output = $"[{_nr} | {_cs:X04}:{_ip:X04}] {LogLevel.TRACE} " + (is_meta ? "; " : "") + what + Environment.NewLine;

lock(_logging_lock)
Expand Down

0 comments on commit 254a8b2

Please sign in to comment.