Save() private method

Writes the log data to the stream
private Save ( Stream stream, LogMessageSaveHelper saveHelper = null ) : void
stream Stream
saveHelper LogMessageSaveHelper
return void
Example #1
0
        /// <summary>
        /// Writes the specified log to the file
        /// </summary>
        /// <param name="log"></param>
        public void Write(LogMessage log)
        {
            m_tmpStream.Position = 0;
            m_tmpStream.Write(true);
            log.Save(m_tmpStream, m_saveHelper);
            long length = m_tmpStream.Position;

            m_tmpStream.Position = 0;
            m_tmpStream.CopyTo(m_zipStream, length, m_tmpBuffer);

            if (log.Level >= MessageLevel.Info)
            {
                m_zipStream.Flush();
            }

            m_logCount++;
        }
Example #2
0
        /// <summary>
        /// Writes the specified log to the file
        /// </summary>
        /// <param name="log"></param>
        /// <param name="autoFlush"></param>
        public void Write(LogMessage log, bool autoFlush = true)
        {
            try
            {
                m_tmpStream.Position = 0;
                m_tmpStream.Write(true);
                log.Save(m_tmpStream, m_saveHelper);
                long length = m_tmpStream.Position;
                m_tmpStream.Position = 0;
                m_tmpStream.CopyTo(m_zipStream, length, m_tmpBuffer);

                if (log.Level >= MessageLevel.Info && autoFlush)
                {
                    m_zipStream.Flush();
                }

                m_logCount++;
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// Writes the specified log to the file
        /// </summary>
        /// <param name="log"></param>
        /// <param name="autoFlush"></param>
        public void Write(LogMessage log, bool autoFlush = true)
        {
            try
            {
                m_tmpStream.Position = 0;
                m_tmpStream.Write(true);
                log.Save(m_tmpStream, m_saveHelper);
                long length = m_tmpStream.Position;
                m_tmpStream.Position = 0;
                m_tmpStream.CopyTo(m_zipStream, length, m_tmpBuffer);

                if (log.Level >= MessageLevel.Info && autoFlush)
                {
                    m_zipStream.Flush();
                }

                m_logCount++;
            }
            catch (Exception)
            {
                throw;
            }
        }