/// <summary> /// This is used to log exceptions. You may use this from anywhere. /// </summary> /// <param name="trace">The error message.</param> /// <param name="source">The source of the message. This can also be a location within a plugin.</param> public void LogError(string trace, Shared.ErrorLocation source) { lock (FileLock) { HandleEncoder(); Encoder.WriteExceptionLog(trace, source); } }
/// <summary> /// This is used to write exception logs. /// </summary> /// <param name="trace">The trace error.</param> /// <param name="location">The source system / plugin name.</param> public void WriteExceptionLog(string trace, Shared.ErrorLocation location) { lock (_writerLock) { if (!IoStream.CanWrite) { return; } BeginWriteLine((byte)Shared.LogType.Error, GetTime()); EncodeStream.WriteByte((byte)location); var data = Encoding.UTF8.GetBytes(Convert.ToBase64String(Encoding.UTF8.GetBytes(trace))); EncodeStream.Write(data, 0, data.Length); EndWriteLine(); } }