Skip to main content

LinuxServerConsole

A class in Root.Township, the global namespace.

Server console for Linux builds: reads commands from standard input on a background thread, prints coloured log lines, and turns SIGINT and SIGTERM into a clean server shutdown.

Constructors​

MemberWhat it is
LinuxServerConsole()Creates a LinuxServerConsole with default values.

Fields​

2 private and internal fields
MemberWhat it is
private bool isAliveKeeps the input loop in RunConsole running; cleared by Shutdown.
private static Logger loggerNLog logger for this class.

Methods​

MemberWhat it is
override void HandleLog(string message, LogLevel level)Writes a log line to the console, coloured by level (yellow warn, red error, dark red fatal).
override void Shutdown()Stops the input thread loop.
3 private and internal methods
MemberWhat it is
private void HandleInteruptSignal(object sender, ConsoleCancelEventArgs e)SIGINT (Ctrl+C) handler: cancels the default kill and asks ApplicationManager to quit with an expected shutdown reason.
private void HandleTerminateSignal(object sender, EventArgs e)Process exit (SIGTERM) handler: asks ApplicationManager to quit with a SIGTERM Received reason.
private void RunConsole()Background thread loop that reads lines from standard input and passes each to OnTextEntered as a command.