コード例 #1
0
 /// <summary>
 /// Thsi method is called when SMTP client has new log entry available.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">Event data.</param>
 private void SmtpClient_WriteLog(object sender,WriteLogEventArgs e)
 {
     try{
         if(m_pServer.Logger == null){
         }
         else if(e.LogEntry.EntryType == LogEntryType.Read){
             m_pServer.Logger.AddRead(m_SessionID,e.LogEntry.UserIdentity,e.LogEntry.Size,e.LogEntry.Text,e.LogEntry.LocalEndPoint,e.LogEntry.RemoteEndPoint);
         }
         else if(e.LogEntry.EntryType == LogEntryType.Text){
             m_pServer.Logger.AddText(m_SessionID,e.LogEntry.UserIdentity,e.LogEntry.Text,e.LogEntry.LocalEndPoint,e.LogEntry.RemoteEndPoint);
         }
         else if(e.LogEntry.EntryType == LogEntryType.Write){
             m_pServer.Logger.AddWrite(m_SessionID,e.LogEntry.UserIdentity,e.LogEntry.Size,e.LogEntry.Text,e.LogEntry.LocalEndPoint,e.LogEntry.RemoteEndPoint);
         }
         else if(e.LogEntry.EntryType == LogEntryType.Exception){
             m_pServer.Logger.AddException(m_SessionID,e.LogEntry.UserIdentity,e.LogEntry.Text,e.LogEntry.LocalEndPoint,e.LogEntry.RemoteEndPoint,e.LogEntry.Exception);
         }
     }
     catch{
     }
 }
コード例 #2
0
ファイル: MailboxReader.cs プロジェクト: ChuckLafferty/bugnet
        /// <summary>
        /// Log the pop 3 client events
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        static void LogPop3Client(object sender, WriteLogEventArgs e)
        {
            try
            {
                var message = "";

                switch (e.LogEntry.EntryType)
                {
                    case LogEntryType.Read:
                        message = string.Format("pop3Client: {0} >> {1}", ObjectToString(e.LogEntry.RemoteEndPoint), e.LogEntry.Text);
                        break;
                    case LogEntryType.Write:
                        message = string.Format("pop3Client: {0} << {1}", ObjectToString(e.LogEntry.RemoteEndPoint), e.LogEntry.Text);
                        break;
                    case LogEntryType.Text:
                        message = string.Format("pop3Client: {0} xx {1}", ObjectToString(e.LogEntry.RemoteEndPoint), e.LogEntry.Text);
                        break;
                }

                LogInfo(message);
            }
            catch (Exception ex)
            {
                LogException(ex);
            }
        }
コード例 #3
0
ファイル: FetchPop3.cs プロジェクト: dioptre/nkd
 /// <summary>
 /// This method is called when new POP3 log entry available.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">Event data.</param>
 private void Pop3_WriteLog(object sender,WriteLogEventArgs e)
 {
     Logger.WriteLog(m_LogPath + "fetch-" + DateTime.Today.ToString("yyyyMMdd") + ".log",e.LogEntry);
 }