mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 16:23:07 -07:00
WebUI: Add command to get the logs
Add /query/getLog and /query/getPeerLog to respectively retrieve the main log and the peer log. GET /query/getLog Params: - normal (bool): include normal messages (default true) - info (bool): include info messages (default true) - warning (bool): include warning messages (default true) - critical (bool): include critical messages (default true) - last_known_id (int): exclude messages with id <= 'last_known_id' GET /query/getPeerLog Params: - last_known_id (int): exclude messages with id <= 'last_known_id'
This commit is contained in:
parent
673b86c6e3
commit
01b73bf704
4 changed files with 115 additions and 0 deletions
|
@ -81,6 +81,8 @@ QMap<QString, QMap<QString, WebApplication::Action> > WebApplication::initialize
|
|||
ADD_ACTION(query, propertiesTrackers);
|
||||
ADD_ACTION(query, propertiesWebSeeds);
|
||||
ADD_ACTION(query, propertiesFiles);
|
||||
ADD_ACTION(query, getLog);
|
||||
ADD_ACTION(query, getPeerLog);
|
||||
ADD_ACTION(sync, maindata);
|
||||
ADD_ACTION(sync, torrent_peers);
|
||||
ADD_ACTION(command, shutdown);
|
||||
|
@ -270,6 +272,44 @@ void WebApplication::action_query_propertiesFiles()
|
|||
print(btjson::getFilesForTorrent(args_.front()), Http::CONTENT_TYPE_JSON);
|
||||
}
|
||||
|
||||
// GET params:
|
||||
// - normal (bool): include normal messages (default true)
|
||||
// - info (bool): include info messages (default true)
|
||||
// - warning (bool): include warning messages (default true)
|
||||
// - critical (bool): include critical messages (default true)
|
||||
// - last_known_id (int): exclude messages with id <= 'last_known_id' (default -1)
|
||||
void WebApplication::action_query_getLog()
|
||||
{
|
||||
CHECK_URI(0);
|
||||
bool normal = request().gets["normal"] != "false";
|
||||
bool info = request().gets["info"] != "false";
|
||||
bool warning = request().gets["warning"] != "false";
|
||||
bool critical = request().gets["critical"] != "false";
|
||||
int lastKnownId;
|
||||
bool ok;
|
||||
|
||||
lastKnownId = request().gets["last_known_id"].toInt(&ok);
|
||||
if (!ok)
|
||||
lastKnownId = -1;
|
||||
|
||||
print(btjson::getLog(normal, info, warning, critical, lastKnownId), Http::CONTENT_TYPE_JSON);
|
||||
}
|
||||
|
||||
// GET params:
|
||||
// - last_known_id (int): exclude messages with id <= 'last_known_id' (default -1)
|
||||
void WebApplication::action_query_getPeerLog()
|
||||
{
|
||||
CHECK_URI(0);
|
||||
int lastKnownId;
|
||||
bool ok;
|
||||
|
||||
lastKnownId = request().gets["last_known_id"].toInt(&ok);
|
||||
if (!ok)
|
||||
lastKnownId = -1;
|
||||
|
||||
print(btjson::getPeerLog(lastKnownId), Http::CONTENT_TYPE_JSON);
|
||||
}
|
||||
|
||||
// GET param:
|
||||
// - rid (int): last response id
|
||||
void WebApplication::action_sync_maindata()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue