34#include <tqdatetime.h> 
   56                   patternResult | appliedAction;
 
   75    TQString timedLog = 
"[" + TQTime::currentTime().toString() + 
"] ";
 
   76    if ( contentType & ~meta )
 
   81    emit logEntryAdded( timedLog );
 
   82    mCurrentLogSize += timedLog.length();
 
   93  if ( size >= 0 && size < 1024 )
 
   96  emit logStateChanged();
 
  104  kdDebug(5006) << 
"----- starting filter log -----" << endl;
 
  105  for ( TQStringList::Iterator it = 
mLogEntries.begin();
 
  108    kdDebug(5006) << *it << endl;
 
  110  kdDebug(5006) << 
"------ end of filter log ------" << endl;
 
  115void FilterLog::checkLogSize()
 
  119    kdDebug(5006) << 
"Filter log: memory limit reached, starting to discard old items, size = " 
  120                  << TQString::number( mCurrentLogSize ) << endl;
 
  124      TQValueListIterator<TQString> it = 
mLogEntries.begin();
 
  127        mCurrentLogSize -= (*it).length();
 
  129        kdDebug(5006) << 
"Filter log: new size = "  
  130                      << TQString::number( mCurrentLogSize ) << endl;
 
  134        kdDebug(5006) << 
"Filter log: size reduction disaster!" << endl;
 
  145    TQFile file( fileName );
 
  146    if( file.open( IO_WriteOnly ) ) {
 
  147      fchmod( file.handle(), S_IRUSR | S_IWUSR );
 
  149        TQDataStream ds( &file );
 
  150        for ( TQStringList::Iterator it = 
mLogEntries.begin(); 
 
  153          TQString tmpString = *it + 
'\n';
 
  154          TQCString cstr( tmpString.local8Bit() );
 
  155          ds.writeRawBytes( cstr, cstr.size() );
 
  165#include "filterlog.moc" 
KMail Filter Log Collector.
 
bool mLogging
the log status
 
bool isLogging()
check the logging state
 
TQStringList mLogEntries
The list contains the single log pieces.
 
void setMaxLogSize(long size=-1)
control the size of the log
 
void clear()
discard collected log data
 
FilterLog()
Non-public constructor needed by the singleton implementation.
 
bool saveToFile(TQString fileName)
save the log to a file - returns true if okay
 
void add(TQString logEntry, ContentType contentType)
add a log entry
 
static FilterLog * instance()
access to the singleton instance
 
long mMaxLogSize
max size for kept log items, when reached the last recently added items are discarded -1 means unlimi...
 
void dump()
dump the log - for testing purposes
 
virtual ~FilterLog()
destructor
 
int mAllowedTypes
types currently allowed to be legged
 
ContentType
log data types