mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-02 18:17:09 +02:00
RobustToolbox projects should be named Robust.* This PR changes the RobustToolbox projects from SS14.* to Robust.* Updates SS14.* prefixes/namespaces to Robust.* Updates SpaceStation14.sln to RobustToolbox.sln Updates MSBUILD/SS14.* to MSBUILD/Robust.* Updates CSProject and MSBuild references for the above Updates git_helper.py Removes Runserver and Runclient as they are unusable
61 lines
1.6 KiB
C#
61 lines
1.6 KiB
C#
using Robust.Client.Interfaces.Console;
|
|
using Robust.Client.Utility;
|
|
using Robust.Shared.Interfaces.Log;
|
|
using Robust.Shared.Log;
|
|
using Robust.Shared.Maths;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Robust.Client.Log
|
|
{
|
|
/// <summary>
|
|
/// Writes logs to the in-game debug console.
|
|
/// </summary>
|
|
class DebugConsoleLogHandler : ILogHandler
|
|
{
|
|
readonly IDebugConsole Console;
|
|
|
|
public DebugConsoleLogHandler(IDebugConsole console)
|
|
{
|
|
Console = console;
|
|
}
|
|
|
|
public void Log(in LogMessage message)
|
|
{
|
|
var formatted = new FormattedMessage(8);
|
|
formatted.PushColor(Color.DarkGray);
|
|
formatted.AddText("[");
|
|
formatted.PushColor(LogLevelToColor(message.Level));
|
|
formatted.AddText(message.LogLevelToName());
|
|
formatted.Pop();
|
|
formatted.AddText($"] {message.SawmillName}: ");
|
|
formatted.Pop();
|
|
formatted.AddText(message.Message);
|
|
Console.AddFormattedLine(formatted);
|
|
}
|
|
|
|
private static Color LogLevelToColor(LogLevel level)
|
|
{
|
|
switch (level)
|
|
{
|
|
case LogLevel.Debug:
|
|
return Color.Blue;
|
|
|
|
case LogLevel.Info:
|
|
return Color.Cyan;
|
|
|
|
case LogLevel.Warning:
|
|
return Color.Yellow;
|
|
|
|
case LogLevel.Error:
|
|
return Color.Red;
|
|
|
|
case LogLevel.Fatal:
|
|
return Color.Red;
|
|
|
|
default:
|
|
return Color.White;
|
|
}
|
|
}
|
|
}
|
|
}
|