private void ConsumerClient_OnConsumeError(IConsumer <string, byte[]> consumer, Error e) { var logArgs = new LogMessageEventArgs { LogType = MqLogType.ServerConnError, Reason = $"An error occurred during connect kafka --> {e.Reason}" }; OnLogError?.Invoke(null, logArgs); }
private void WriteError(Token token, string text) { Debug($"Error ({token}): {text}"); if (LogOptions.EnableError) { if (token == null) { OnLogError?.Invoke(text); } else { OnLogTokenizedError?.Invoke(token, text); } } }
/// <summary> /// Invokes onLogError or throws exception if throwError is enabled /// </summary> /// <param name="errorType"></param> private static void DispatchError(ErrorType errorType) { if (throwError) { switch (errorType) { case ErrorType.PathNotSet: { throw new ArgumentException(ErrorMessages[ErrorType.PathNotSet]); } case ErrorType.PathNotAccessible: { throw new AccessViolationException(ErrorMessages[ErrorType.PathNotAccessible]); } default: break; } } OnLogError?.Invoke(errorType, ErrorMessages[errorType]); }
/// <summary> /// Log a error event to the event log. If we can't write to the event log, nothing happens. /// </summary> /// <param name="text">The event text</param> /// <param name="pid">The event program source.</param> /// <param name="code">The event code</param> public static void LogError(Exception e, string pid, int code) { if (PhazeXLog.writeFileLog) { try { if (Filename != null) { StreamWriter sw = new StreamWriter(Filename, true, Encoding.ASCII); DateTime dt = DateTime.Now; sw.Write("[ ERROR ] [" + dt.ToShortDateString() + " " + dt.ToLongTimeString() + "] "); sw.Write(e.Message + newLine); sw.Write(e.StackTrace + newLine); sw.Close(); } } catch { } } #if !PocketPC if (WriteEventLog) { try { EventLog.WriteEntry(pid, e.ToString(), EventLogEntryType.Error, code); } catch { // don't do anything -- this was our last resort } } #endif if (OnLogError != null) { OnLogError.Invoke(e, pid, code); } }
public void Error(string message) { OnLogError.Invoke(message); }
private void LogError(string message) { OnLogError?.Invoke(message); }
internal void LogError(string message) { OnLogError?.Invoke(message); }
public static void LogError(string message) { OnLogError?.Invoke(message); }
public void SendLogError(String logError) { OnLogError?.Invoke(logError); }
/// <summary> /// Logs an error. /// </summary> /// <param name="errorCode">The error code.</param> /// <param name="file">The file associated with the message.</param> /// <param name="lineNumber">The line number within the associated file.</param> /// <param name="message">The message to log.</param> public static void LogError(string errorCode, string file, int lineNumber, string message) { OnLogError.Invoke(errorCode, file, lineNumber, message); }
internal void RaiseLogError(object sender, LogMessageEventArgs e) { OnLogError?.Invoke(sender, e); }