MailCommon::FilterLog Class
class MailCommon::FilterLogKMail Filter Log Collector. More...
| Header: | #include <MailCommon/FilterLog> |
| CMake: | find_package(KPim6MailCommon REQUIRED)target_link_libraries(mytarget PRIVATE KPim6::MailCommon) |
| Inherits: | QObject |
Public Types
| enum | ContentType { Meta, PatternDescription, RuleResult, PatternResult, AppliedAction } |
Public Functions
| virtual | ~FilterLog() override |
| void | add(const QString &entry, MailCommon::FilterLog::ContentType type) |
| void | addSeparator() |
| void | clear() |
| void | dump() |
| bool | isContentTypeEnabled(MailCommon::FilterLog::ContentType type) const |
| bool | isLogging() const |
| QStringList | logEntries() const |
| long | maxLogSize() const |
| bool | saveToFile(const QString &fileName) const |
| void | setContentTypeEnabled(MailCommon::FilterLog::ContentType type, bool enabled) |
| void | setLogging(bool active) |
| void | setMaxLogSize(long size = -1) |
Signals
| void | logEntryAdded(const QString &entry) |
| void | logShrinked() |
| void | logStateChanged() |
Static Public Members
Detailed Description
The filter log helps to collect log information about the filter process in KMail. It's implemented as singleton, so it's easy to direct pieces of information to a unique instance. It's possible to activate / deactivate logging. All collected log information can get thrown away, the next added log entry is the first one until another clearing. A signal is emitted whenever a new logentry is added, when the log was cleared or any log state was changed.
Author: Andreas Gungl <a.gungl@gmx.de>
Member Type Documentation
enum FilterLog::ContentType
Describes the type of content that will be logged.
| Constant | Value | Description |
|---|---|---|
MailCommon::FilterLog::Meta | 1 | Log all meta data. |
MailCommon::FilterLog::PatternDescription | 2 | Log all pattern description. |
MailCommon::FilterLog::RuleResult | 4 | Log all rule matching results. |
MailCommon::FilterLog::PatternResult | 8 | Log all pattern matching results. |
MailCommon::FilterLog::AppliedAction | 16 | Log all applied actions. |
Member Function Documentation
[override virtual noexcept] FilterLog::~FilterLog()
Destroys the filter log.
void FilterLog::add(const QString &entry, MailCommon::FilterLog::ContentType type)
Adds the given log entry under the given content type to the log.
void FilterLog::addSeparator()
Adds a separator line to the log.
void FilterLog::clear()
Clears the log.
void FilterLog::dump()
Dumps the log to console. Used for debugging.
[static] MailCommon::FilterLog *FilterLog::instance()
Returns the single global instance of the filter log.
bool FilterLog::isContentTypeEnabled(MailCommon::FilterLog::ContentType type) const
Returns whether the given content type is enabled for logging.
bool FilterLog::isLogging() const
Returns whether the filter log is currently active.
QStringList FilterLog::logEntries() const
Returns the list of log entries.
[signal] void FilterLog::logEntryAdded(const QString &entry)
This signal is emitted whenever a new entry has been added to the log.
[signal] void FilterLog::logShrinked()
This signal is emitted whenever the log has shrunk.
[signal] void FilterLog::logStateChanged()
This signal is emitted whenever the activity of the filter log has been changed.
long FilterLog::maxLogSize() const
Returns the maximum size of the log in bytes.
See also setMaxLogSize().
[static] QString FilterLog::recode(const QString &plain)
Returns an escaped version of the log text plain which can be used in a HTML document.
bool FilterLog::saveToFile(const QString &fileName) const
Saves the log to the file with the given fileName.
Returns true on success or false on failure.
void FilterLog::setContentTypeEnabled(MailCommon::FilterLog::ContentType type, bool enabled)
Sets whether a given content type will be enabled for logging.
See also isContentTypeEnabled().
void FilterLog::setLogging(bool active)
Sets whether the filter log is currently active.
See also isLogging().
void FilterLog::setMaxLogSize(long size = -1)
Sets the maximum size of the log in bytes.
See also maxLogSize().