fleshing out json output feature

This commit is contained in:
2019-09-18 18:03:21 +02:00
parent 91e0333e19
commit 94881f499b
4 changed files with 12 additions and 7 deletions

View File

@@ -67,8 +67,11 @@ class MVCController{
//check if testaction is valid
if(file_exists($this->testaction)){
echo('"output": [');
//execute testaction
include_once($this->testaction);
echo("]");
}
}

View File

@@ -4,11 +4,16 @@
class TestUtils{
public static $log = [];
public static $status;
public static function log($output, $status = "OK"){
public static function log($output, $status = "OK",$addComma = false){
$loginput = [];
$loginput['message'] = $output;
$loginput['status'] = $status;
echo(json_encode($loginput));
if($addComma){
echo(',');
}
echo("\n");
return;
}
public static function returnLog(){
echo(json_encode(self::$log));