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);
        }
Exemplo n.º 2
0
 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);
         }
     }
 }
Exemplo n.º 3
0
        /// <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]);
        }
Exemplo n.º 4
0
        /// <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);
            }
        }
Exemplo n.º 5
0
 public void Error(string message)
 {
     OnLogError.Invoke(message);
 }
Exemplo n.º 6
0
 private void LogError(string message)
 {
     OnLogError?.Invoke(message);
 }
Exemplo n.º 7
0
 internal void LogError(string message)
 {
     OnLogError?.Invoke(message);
 }
Exemplo n.º 8
0
 public static void LogError(string message)
 {
     OnLogError?.Invoke(message);
 }
Exemplo n.º 9
0
 public void SendLogError(String logError)
 {
     OnLogError?.Invoke(logError);
 }
Exemplo n.º 10
0
 /// <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);
 }
Exemplo n.º 11
0
 internal void RaiseLogError(object sender, LogMessageEventArgs e)
 {
     OnLogError?.Invoke(sender, e);
 }