예제 #1
0
        /// <summary>
        /// Writes log message into log
        /// </summary>
        /// <param name="msg">Message to write</param>
        /// <param name="urgent">Indicates that the logging service implementation must
        /// make an effort to write the message to its destinations urgently</param>
        public void Write(Message msg, bool urgent)
        {
            if (Status != ServiceStatus.Active)
            {
                return;
            }


            if (msg == null)
            {
                return;
            }

            if (msg.Type >= MessageType.Emergency)
            {
                m_LastCatastrophy = msg;
            }
            else
            if (msg.Type >= MessageType.Error)
            {
                m_LastError = msg;
            }
            else
            if (msg.Type >= MessageType.Warning)
            {
                m_LastWarning = msg;
            }

            if (m_InstrumentationEnabled)
            {
                m_InstrBuffer.Send(msg);
            }

            DoWrite(msg, urgent);
        }
예제 #2
0
파일: LogDaemonBase.cs 프로젝트: azist/azos
        /// <summary>
        /// Writes log message into log
        /// </summary>
        /// <param name="msg">Message to write</param>
        /// <param name="urgent">
        /// Indicates that the logging service implementation must
        /// make an effort to write the message to its destination sinks urgently
        /// </param>
        public void Write(Message msg, bool urgent)
        {
            if (msg == null)
            {
                return;
            }

            if (Status != DaemonStatus.Active)
            {
                return;
            }

            msg.InitDefaultFields(App);

            if (msg.Type >= MessageType.Emergency)
            {
                m_LastCatastrophy = msg;
            }
            else
            if (msg.Type >= MessageType.Error)
            {
                m_LastError = msg;
            }
            else
            if (msg.Type >= MessageType.Warning)
            {
                m_LastWarning = msg;
            }

            if (m_InstrumentationEnabled)
            {
                lock (m_InstrBuffer)
                    m_InstrBuffer.Send(msg);
            }

            DoWrite(msg, urgent);
        }