Index: src/webapp/webservice/inc/GnuBoat/Service.php
===================================================================
--- src/webapp/webservice/inc/GnuBoat/Service.php	(revision 008bce99c15e3dad6fcf395f8c3a3f69b23b4b28)
+++ src/webapp/webservice/inc/GnuBoat/Service.php	(revision 831127686ec0d86c0d75ef010cd7b51fa129d608)
@@ -45,13 +45,32 @@
 	}
 	
-	public static function error($message)
+	public static function errorStatic($message, $additionalContent = array(), $debug)
 	{
-		Service::output(["error" => 1, "errormessage" => $message]);
+		error_log($message);
+		if($debug > 0)
+			print $message ."\n";
+		$result = ["error" => 1, "errormessage" => $message];
+		Service::outputStatic(array_merge($result, $additionalContent), $debug);
 	}
 	
-	public static function output($content)
+	public static function outputStatic($content, $debug)
 	{
 		header('Content-Type: application/json');
-		echo json_encode($content);
+		if($debug > 0){
+			echo json_encode($content,  JSON_PRETTY_PRINT) ."\n";
+		}
+		else{
+			echo json_encode($content) ."\n";
+		}
+	}
+	
+	protected function error($message, $additionalContent = array())
+	{
+		Service::errorStatic($message, $additionalContent, $this->debug());
+	}
+	
+	protected function output($content)
+	{
+		Service::outputStatic($content, $this->debug());
 	}
 
