Пример #1
0
 void LogIfDayChanged(ChatlogMetaData metaData, LogEntry entry)
 {
     if (metaData.LastWrite.Date != entry.Timestamp.Date)
     {
         logWriter.Enqueue(
             new LogEntry(
                 metaData.LogfilePath, entry.Timestamp,
                 "--- Day has changed {0:ddd dd MMM yyyy}", entry.Timestamp)
             );
     }
 }
Пример #2
0
        ChatlogMetaData GetMetaData(string ircEntity, DateTimeOffset now)
        {
            if (!chatlogs.TryGetValue(ircEntity, out ChatlogMetaData metaData))
            {
                // Rotate non-channel logs more leisurely.
                var rotateSched = MessageTools.IsChannel(ircEntity) ?
                                  LogRotateSchedule.Daily : LogRotateSchedule.Yearly;

                metaData = new ChatlogMetaData(
                    chatlogDir, ircEntity,
                    rotateSched, now
                    );
                chatlogs[ircEntity] = metaData;
            }

            return(metaData);
        }