public bool Flush(LoggerInformation loggerInformation)
 {
     byte[] writeInfo = Encoding.Default.GetBytes(loggerInformation.GetLoggerStringMessage());
     fileStream.Write(writeInfo, 0, writeInfo.Length);
     fileStream.Flush();
     return(true);
 }
        public async Task <bool> FlushAsync(LoggerInformation loggerInformation)
        {
            byte[] writeInfo = Encoding.Default.GetBytes(loggerInformation.GetLoggerStringMessage());
            fileStream.Write(writeInfo, 0, writeInfo.Length);
            await fileStream.FlushAsync();

            return(true);
        }
Example #3
0
        public async Task <bool> FlushAsync(LoggerInformation loggerInformation)
        {
            byte[]     writeInfo = Encoding.Default.GetBytes(loggerInformation.GetLoggerStringMessage());
            IPEndPoint server    = new IPEndPoint(IPAddress.Parse(serverIp), serverPort);

            UDP_Client.Send(writeInfo, writeInfo.Length, server);
            return(true);
        }
 public void Log(LoggerInformation loggerInformation)
 {
     if (loggerInfoList.Count == bufferLimit)
     {
         ThreadPool.QueueUserWorkItem(LoggersFlush, new ThreadInformation
         {
             threadInfoList = loggerInfoList,
             threadNumber   = buffersCount++
         });
         loggerInfoList = new List <LoggerInformation>();
     }
     loggerInfoList.Add(loggerInformation);
 }