using System; using System.Runtime.CompilerServices; using BepInEx.ConsoleUtil; namespace BepInEx { /// /// A helper class to use for logging. /// [Obsolete("This class has been deprecated; please use the Logger static class and BaseLogger implementations", true)] public static class BepInLogger { /// /// The handler for a entry logged event. /// /// The text element of the log itself. /// Whether or not it should be dislpayed to the user. public delegate void EntryLoggedEventHandler(string entry, bool show = false); /// /// The listener event for an entry being logged. /// public static event EntryLoggedEventHandler EntryLogged; /// /// Logs an entry to the logger, and any listeners are notified of the entry. /// /// The text element of the log itself. /// Whether or not it should be dislpayed to the user. public static void Log(string entry, bool show = false) { Log(entry, show, ConsoleColor.Gray); } /// /// Logs an entry to the logger, and any listeners are notified of the entry. /// /// The text element of the log itself. Uses .ToString(). /// Whether or not it should be dislpayed to the user. /// The color of the text to show in the console. public static void Log(object entry, bool show, ConsoleColor color) { Log(entry.ToString(), show, color); } /// /// Logs an entry to the logger, and any listeners are notified of the entry. /// /// The text element of the log itself. /// Whether or not it should be dislpayed to the user. /// The color of the text to show in the console. public static void Log(string entry, bool show, ConsoleColor color) { UnityEngine.UnityLogWriter.WriteStringToUnityLog($"BEPIN - {entry}\r\n"); Kon.ForegroundColor = color; Console.WriteLine(entry); EntryLogged?.Invoke(entry, show); } } }