Exemplo n.º 1
0
 /*
  *  This function will send all logs within the logList while emptying the queue in the process.
  *  These logs are sent to the Logstash Client running on the server end.
  */
 public static void PostAllLogs()
 {
     if (postRequest && hasConnection && LogList != null && LogList.Count >= 1)
     {
         while (LogList.Count > 0 && Connection != null)
         {
             Connection.Send(LogList.Dequeue());
         }
     }
 }
Exemplo n.º 2
0
        public void Write(LogInfoType logType, string log, int pipe_id)
        {
            var f_log = LogHelpper.Format(logType, log, pipe_id);

            lock (lock_object)
            {
                LogList.Enqueue(f_log);

                // 上限行数を超えていたら末尾のものを取り除く。
                if (LogList.Count > MaxLine)
                {
                    LogList.Dequeue();
                }
            }

            // イベントハンドラが設定されていればcallbackしたいが、lock解除してからでないとdead lockになる。

            ListAdded?.Invoke(f_log);
        }