mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 15:56:07 -07:00
Add Plex Media Scanner log files to Log viewer.
This commit is contained in:
parent
1c8428c3ea
commit
71d30af582
3 changed files with 40 additions and 4 deletions
|
@ -29,6 +29,7 @@ from plexpy import helpers
|
|||
<ul class="nav nav-pills" role="tablist">
|
||||
<li role="presentation" class="active"><a id="plexpy-logs-btn" href="#tabs-1" aria-controls="tabs-1" role="tab" data-toggle="tab">PlexPy Logs</a></li>
|
||||
<li role="presentation"><a id="plex-logs-btn" href="#tabs-2" aria-controls="tabs-2" role="tab" data-toggle="tab">Plex Media Server Logs</a></li>
|
||||
<li role="presentation"><a id="plex-scanner-logs-btn" href="#tabs-3" aria-controls="tabs-3" role="tab" data-toggle="tab">Plex Media Scanner Logs</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane active" id="tabs-1">
|
||||
|
@ -57,6 +58,19 @@ from plexpy import helpers
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="tabs-3">
|
||||
<table class="display" id="plex_scanner_log_table" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align='left' id="plex_scanner_timestamp">Timestamp</th>
|
||||
<th align='left' id="plex_scanner_level">Level</th>
|
||||
<th align='left' id="plex_scanner_message">Message</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -98,11 +112,18 @@ from plexpy import helpers
|
|||
|
||||
function LoadPlexLogs() {
|
||||
plex_log_table_options.ajax = {
|
||||
"url": "get_plex_log"
|
||||
"url": "get_plex_log?log_type=server"
|
||||
}
|
||||
plex_log_table = $('#plex_log_table').DataTable(plex_log_table_options);
|
||||
}
|
||||
|
||||
function LoadPlexScannerLogs() {
|
||||
plex_log_table_options.ajax = {
|
||||
"url": "get_plex_log?log_type=scanner"
|
||||
}
|
||||
plex_scanner_log_table = $('#plex_scanner_log_table').DataTable(plex_log_table_options);
|
||||
}
|
||||
|
||||
$("#plexpy-logs-btn").click(function() {
|
||||
$("#clear-logs").show();
|
||||
LoadPlexPyLogs();
|
||||
|
@ -115,6 +136,12 @@ from plexpy import helpers
|
|||
clearSearchButton('plex_log_table', plex_log_table);
|
||||
});
|
||||
|
||||
$("#plex-scanner-logs-btn").click(function() {
|
||||
$("#clear-logs").hide();
|
||||
LoadPlexScannerLogs();
|
||||
clearSearchButton('plex_scanner_log_table', plex_scanner_log_table);
|
||||
});
|
||||
|
||||
$("#clear-logs").click(function() {
|
||||
var r = confirm("Are you sure you want to clear the PlexPy log?");
|
||||
if (r == true) {
|
||||
|
|
|
@ -18,10 +18,14 @@ import re
|
|||
import os
|
||||
import plexpy
|
||||
|
||||
def get_log_tail(window=20, parsed=True):
|
||||
def get_log_tail(window=20, parsed=True, log_type="server"):
|
||||
|
||||
if plexpy.CONFIG.PMS_LOGS_FOLDER:
|
||||
log_file = ""
|
||||
if log_type == "server":
|
||||
log_file = os.path.join(plexpy.CONFIG.PMS_LOGS_FOLDER, 'Plex Media Server.log')
|
||||
elif log_type == "scanner":
|
||||
log_file = os.path.join(plexpy.CONFIG.PMS_LOGS_FOLDER, 'Plex Media Scanner.log')
|
||||
else:
|
||||
return []
|
||||
|
||||
|
|
|
@ -1072,8 +1072,13 @@ class WebInterface(object):
|
|||
@addtoapi()
|
||||
def get_plex_log(self, window=1000, **kwargs):
|
||||
log_lines = []
|
||||
log_type = ""
|
||||
|
||||
if 'log_type' in kwargs:
|
||||
log_type = kwargs.get('log_type', "server")
|
||||
|
||||
try:
|
||||
log_lines = {'data': log_reader.get_log_tail(window=window)}
|
||||
log_lines = {'data': log_reader.get_log_tail(window=window, parsed=True, log_type=log_type)}
|
||||
except:
|
||||
logger.warn(u"Unable to retrieve Plex Logs.")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue