public LogMessage(DateTime timestamp, int threadId, CoreLogLevel level, string message, Exception exception) { Timestamp = timestamp; ThreadId = threadId; Level = level; Message = message; Exception = exception; }
public static void Log(CoreLogLevel level, string message) { var tw = TextWriter; if (tw != null && (LogLevel >= level || level == CoreLogLevel.Initialisation)) { tw.WriteLine(level == CoreLogLevel.Initialisation ? message : $"[SampSharp:{GetLevelName(level)}] {message}"); } }
public static void Log(CoreLogLevel level, string message) { if (Stream != null && (LogLevel >= level || level == CoreLogLevel.Initialisation)) { using (var sw = new StreamWriter(Stream, Encoding.ASCII, 1024, true)) { sw.WriteLine(level == CoreLogLevel.Initialisation ? message : $"[SampSharp:{GetLevelName(level)}] {message}"); } } }
public void Log(CoreLogLevel loglevel, string message, Exception exception) { var hasGlobalListeners = GlobalLogger.HasListeners; var newlog = new LogMessage(DateTime.UtcNow, Environment.CurrentManagedThreadId, loglevel, message, exception); if (hasGlobalListeners) { GlobalLogger.Publish(newlog); } }
public static bool DoesLog(CoreLogLevel level) { return(LogLevel >= level || level == CoreLogLevel.Initialisation); }
private static string GetLevelName(CoreLogLevel level) { return(level.ToString().ToUpper()); }
/// <summary> /// Uses the specified log level as the maximum level which is written to the log by SampSharp. /// </summary> /// <param name="logLevel">The log level.</param> /// <returns>The updated game mode configuration builder.</returns> public GameModeBuilder UseLogLevel(CoreLogLevel logLevel) { CoreLog.LogLevel = logLevel; return(this); }