yuanshen/Yuanshen.SDK/Log.cs
wisedev fc2ac1050f First working version of the server
KCP gameserver with packet dispatch, scene streaming, combat, gacha and the
shop, plus a small HTTP server for the login flow and the wish history page.

Game data under assets is pulled out of the client instead of being typed by
hand. The excel tables come from the packed bin container and the spawn points
from the compiled scene scripts.
2026-09-04 02:10:50 +03:00

27 lines
1.2 KiB
C#

using System.Drawing;
using Pastel;
using Yuanshen.Common.Console;
namespace Yuanshen.SDK;
public static class Log
{
private static readonly Color Timestamp = Color.FromArgb(0x5A, 0x4E, 0x68);
private static readonly Color BootColor = Color.FromArgb(0x7C, 0xE8, 0xA4);
private static readonly Color HttpColor = Color.FromArgb(0xC7, 0x7D, 0xFF);
private static readonly Color MissColor = Color.FromArgb(0xFF, 0xB3, 0x4D);
public static void Ready(string url) => Write(BootColor, "boot", $"listening on {url}");
public static void Http(string method, string path) => Write(HttpColor, "http", $"{method,-4} {path}");
public static void Unhandled(string method, string path) => Write(MissColor, "miss", $"{method,-4} {path}");
public static void Info(string message) => Write(ConsoleTheme.Accent, "info", message);
public static void Warn(string message) => Write(MissColor, "warn", message);
private static void Write(Color color, string tag, string message)
{
ConsolePrompt.Write(
$"{DateTime.Now:HH:mm:ss}".Pastel(Timestamp) + " " +
tag.Pastel(color) + " " +
message.Pastel(ConsoleTheme.Text));
}
}