public void PluginWriteLine(TerrariaPlugin plugin, string message, TraceLevel kind) { try { this.WrappedLogWriter.PluginWriteLine(plugin, message, kind); } catch (Exception ex) { DefaultLogWriter.ServerWriteLine(string.Format( "The attached log writer \"{0}\" has thrown an unexpected exception:\n{1}", this.LogWriterName, ex), TraceLevel.Error); } }
internal static void Configure(ILogWriter logger) { if (logger != null) { Logger = logger; LogDebugMessage.CustomLoggerUsed(file); } else { Logger = new DefaultLogWriter(); LogErrorMessage.CustomLoggerMisconfigured(file); } }
internal void Deatch() { if (this.WrappedLogWriter == null) { return; } try { this.WrappedLogWriter.Detach(); } catch (Exception ex) { DefaultLogWriter.ServerWriteLine( string.Format("Log writer \"{0}\" has thrown an unexpected exception:\n{1}", this.LogWriterName, ex), TraceLevel.Error); } this.WrappedLogWriter = null; }