The static EventLog class provides a centralized logging mechanism. It stores text messages in a list and prints them to the console for visibility.
using Sandbox;
using System.Collections.Generic;
public static class EventLog
{
// This holds all the messages so your UI can read them later
public static List<string> Messages { get; private set; } = new();
public static void Add( string message )
{
// 1. Prints it to the player HUD log system (we hook this up to your UI later)
Messages.Add( message );
// 2. Also prints it to the developer console so you can see it right now
Log.Info( message );
}
public static void Clear()
{
Messages.Clear();
}
}