libktorrent
2.2.0
|
Class which writes messages to a logfile. More...
#include <log.h>
Public Member Functions | |
Log () | |
virtual | ~Log () |
void | addMonitor (LogMonitorInterface *m) |
void | lock () |
Lock the mutex of the log, should be called in Out() | |
void | logRotateDone () |
Called by the auto log rotate job when it has finished. | |
Log & | operator<< (const char *s) |
Log & | operator<< (const QString &s) |
Log & | operator<< (const QUrl &url) |
Log & | operator<< (Int64 v) |
Log & | operator<< (Log &(*func)(Log &)) |
template<class T > | |
Log & | operator<< (T val) |
Log & | operator<< (Uint64 v) |
void | removeMonitor (LogMonitorInterface *m) |
void | setFilter (unsigned int filter) |
void | setOutputFile (const QString &file, bool rotate, bool handle_qt_messages) |
void | setOutputToConsole (bool on) |
Friends | |
KTORRENT_EXPORT friend Log & | endl (Log &lg) |
By default all messages will also be printed on the standard output. This can be turned down using the setOutputToConsole function.
There is also the possibility to monitor what is written to the log using the LogMonitorInterface class.
bt::Log::Log | ( | ) |
Constructor.
|
virtual |
Destructor, closes the file.
void bt::Log::addMonitor | ( | LogMonitorInterface * | m | ) |
Add a log monitor.
m | The log monitor |
Log& bt::Log::operator<< | ( | const char * | s | ) |
Log& bt::Log::operator<< | ( | const QString & | s | ) |
Log& bt::Log::operator<< | ( | const QUrl & | url | ) |
Log& bt::Log::operator<< | ( | Int64 | v | ) |
|
inline |
Log& bt::Log::operator<< | ( | Uint64 | v | ) |
void bt::Log::removeMonitor | ( | LogMonitorInterface * | m | ) |
Remove a log monitor. It will not be deleted.
m | The log monitor |
void bt::Log::setFilter | ( | unsigned int | filter | ) |
Sets a filter for log messages. Applies only to listeners via LogMonitorInterface!
filter | SYS & LOG flags combined with bitwise OR. |
void bt::Log::setOutputFile | ( | const QString & | file, |
bool | rotate, | ||
bool | handle_qt_messages | ||
) |
Set the output logfile.
file | The name of the file |
rotate | Whether or not to rotate the logs |
bool | handle_qt_messages Whether or not handle Qt messages |
Exception | if the file can't be opened |
void bt::Log::setOutputToConsole | ( | bool | on | ) |
Enable or disable the printing of log messages to the standard output.
on | Enable or disable |