new logging

This commit is contained in:
jb-alvarado 2019-11-18 10:07:50 +01:00
parent 4f13283532
commit 8774a1adf5
4 changed files with 46 additions and 9 deletions

View File

@ -71,6 +71,8 @@
<div id="log-area" class="foot logging">
<div class="log-tabs">
<div id="bt_play" class="active logwindow">Playing</div>
<div id="bt_dec" class="logwindow">Decoder</div>
<div id="bt_enc" class="logwindow">Encoder</div>
<div id="bt_sys" class="logwindow">System</div>
</div>

View File

@ -647,7 +647,7 @@ footer logging taps
.log-tabs {
overflow: hidden;
max-width: 127px;
max-width: 263px;
color: #111111;
}

View File

@ -344,13 +344,35 @@ function get_log(logtype) {
$('#bt_play').click(function() {
$(this).addClass("active");
$('#bt_sys').removeClass("active");
$('#bt_enc').removeClass("active");
$('#bt_dec').removeClass("active");
get_log("playing");
});
$('#bt_dec').click(function() {
$(this).addClass("active");
$('#bt_sys').removeClass("active");
$('#bt_enc').removeClass("active");
$('#bt_play').removeClass("active");
get_log("decoder");
});
$('#bt_enc').click(function() {
$(this).addClass("active");
$('#bt_sys').removeClass("active");
$('#bt_dec').removeClass("active");
$('#bt_play').removeClass("active");
get_log("encoder");
});
$('#bt_sys').click(function() {
$(this).addClass("active");
$('#bt_play').removeClass("active");
$('#bt_enc').removeClass("active");
$('#bt_dec').removeClass("active");
get_log("system");
});

View File

@ -2,20 +2,33 @@
error_reporting(E_ALL);
ini_set('display_errors', 'On');
// get config file
function get_ini() {
return parse_ini_file("/etc/ffplayout/ffplayout.conf", TRUE, INI_SCANNER_RAW);
}
function printer($file) {
$ini = get_ini();
$log_file = $ini['LOGGING']['log_path'] . $file;
$open_log = fopen($log_file, "r") or die("Unable to open file!");
echo fread($open_log,filesize($log_file));
fclose($open_log);
}
// get playout log
if(!empty($_GET['log_from'])) {
$log_from = $_GET['log_from'];
if ($log_from === "playing") {
$get_ini = file_get_contents("/etc/ffplayout/ffplayout.conf");
$get_path = "/^log_file.*\$/m";
preg_match_all($get_path, $get_ini, $matches);
$line = implode("\n", $matches[0]);
$log_file = explode("= ", $line)[1];
printer("/ffplayout.log");
}
$open_log = fopen($log_file, "r") or die("Unable to open file!");
echo fread($open_log,filesize($log_file));
fclose($open_log);
if ($log_from === "decoder") {
printer("/decoder.log");
}
if ($log_from === "encoder") {
printer("/encoder.log");
}
if ($log_from === "system") {