Ejemplo n.º 1
0
 private void WriteLogNode(XmlTextWriter writer, LogItem m)
 {
     writer.WriteStartElement("logfile-item");
      WriteElement(writer, "log-dir", m.LogDir);
      WriteElement(writer, "filespec", m.Filespec);
      WriteElement(writer, "datemailed", string.Format("{0:u}", m.MailDate));
      writer.WriteEndElement();
 }
Ejemplo n.º 2
0
 public void PutItem(LogItem m)
 {
     var filespec = m.Filespec;
      if (!TheHt.ContainsKey(filespec))
      {
     TheHt.Add(filespec, m);
     IsDirty = true;
      }
 }
Ejemplo n.º 3
0
      private DateTime MailLogFiles(LogItem logitem)
      {
         var lastDate = new DateTime( 1, 1, 1 );
         var filesFound = LogFileDetector.DetectLogFileIn( logitem.LogDir, logitem.Filespec, logitem.MailDate );

         LogitIfThereWereNofilesFound( logitem, filesFound );

         foreach ( var file in filesFound )
         {
            var errorMsg = MailMan.SendMail( message: "Recently Added", subject: SubjectLine(file), attachment: file );

            lastDate = LogResult( logitem, lastDate, file, errorMsg );
         }
         return lastDate;
      }
Ejemplo n.º 4
0
 private void LogitIfThereWereNofilesFound( LogItem logitem, List<string> filesFound )
 {
    if ( NoFilesWereFound( filesFound ) )
    {
       Logger.Info(
          string.Format( "  No Files were found in {0} like {1} later than {2}",
          logitem.LogDir, logitem.Filespec, logitem.MailDate ) );
    }
 }
Ejemplo n.º 5
0
 private DateTime LogResult( LogItem logitem, DateTime lastDate, string file, string errorMsg )
 {
    if ( string.IsNullOrEmpty( errorMsg ) )
    {
       lastDate = LogFileDetector.FileDate( logitem.LogDir, LogFileDetector.FilePartFile( logitem.LogDir, file ) );
       LogsMailed++;
       Logger.Info( string.Format( "Emailed {0}", file ) );
    }
    else
    {
       Logger.Error( string.Format( "Failed to email {0} - {1}", file, errorMsg ) );
    }
    return lastDate;
 }
Ejemplo n.º 6
0
 private DateTime MailLogFiles(LogItem logitem)
 {
     var lastDate = new DateTime(1, 1, 1);
      var filesFound = LogFileDetector.DetectLogFileIn(logitem.LogDir, logitem.Filespec, logitem.MailDate);
      foreach (var file in filesFound)
      {
     var errorMsg = MailMan.SendMail(message: "Log file", subject: "For perusal", attachment:file);
     if (string.IsNullOrEmpty(errorMsg))
     {
        lastDate = LogFileDetector.FileDate(logitem.LogDir, LogFileDetector.FilePartFile(logitem.LogDir, file));
        LogsMailed++;
        Logger.Info(string.Format("Emailed {0}", file));
     }
     else
     {
        Logger.Error(string.Format("Failed to email {0} - {1}", file, errorMsg));
     }
      }
      return lastDate;
 }
Ejemplo n.º 7
0
 private void AddLogItem(LogItem logItem)
 {
     PutItem(logItem);
 }