Skip to content

Commit 9b07a89

Browse files
fix log formatting
1 parent b148c49 commit 9b07a89

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

Helpers/Log.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,23 @@ public static void Signal(object o)
2020

2121
public static void Warn(Script scr, object obj)
2222
{
23-
var ident = scr.CurrentLine == 0 ? "Compile warning" : $"Warning in line {scr.CurrentLine}";
23+
var ident = scr.CurrentLine == 0 ? "Compile warning" : $"Line {scr.CurrentLine}";
2424
Logger.Raw($"[Script '{scr.Name}'] [{ident}] {obj}", ConsoleColor.Yellow);
2525
}
2626

27-
public static void Warn(string scrName, object obj)
27+
public static void Warn(string scrName, uint line, object obj)
2828
{
29-
Logger.Raw($"[Script '{scrName}'] {obj}", ConsoleColor.Yellow);
29+
Logger.Raw($"[Script '{scrName}'] [Line {line}] {obj}", ConsoleColor.Yellow);
3030
}
3131

32-
public static void Error(string scrName, string msg)
32+
public static void RuntimeError(string scrName, uint line, string msg)
3333
{
34-
Logger.Raw($"[Script '{scrName}'] {msg}", ConsoleColor.Red);
34+
Logger.Raw($"[Script '{scrName}'] [Line {line}] {msg}", ConsoleColor.Red);
35+
}
36+
37+
public static void CompileError(string scrName, string msg)
38+
{
39+
Logger.Raw($"[Script '{scrName}'] [Compile error] {msg}", ConsoleColor.Red);
3540
}
3641

3742
public static void D(string msg)

ScriptSystem/Structures/ServerConsoleExecutor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ public override void Reply(string content, Script scr)
1919

2020
public override void Warn(string content, Script scr)
2121
{
22-
Log.Warn(scr, $"[Script '{scr.Name}'] [{(scr.CurrentLine == 0 ? "Compile warning" : $"Line {scr.CurrentLine}")} {content}");
22+
Log.Warn(scr, content);
2323
}
2424

2525
public override void Error(string content, Script scr)
2626
{
27-
Log.Error(scr.Name, $"[{(scr.CurrentLine == 0 ? "Compile error" : $"Line {scr.CurrentLine}")}] {content}");
27+
Log.RuntimeError(scr.Name, scr.CurrentLine, content);
2828
}
2929
}

0 commit comments

Comments
 (0)