public function formatlog($messages, $loglevel)
 {
     $msg = array();
     foreach ($messages as $message) {
         if (is_array($message) || is_object($message)) {
             //$msg[] = print_r($message, true);
             $msg[] = PluginFusioninventoryToolbox::formatJson(json_encode($message));
         } else {
             if (is_null($message)) {
                 $msg[] = ' NULL';
             } else {
                 if (is_bool($message)) {
                     $msg[] = $message ? 'true' : 'false';
                 } else {
                     $msg[] = $message;
                 }
             }
         }
     }
     return $loglevel['name'] . ': ' . implode("\n", $msg);
 }
 static function display_json_debug(PluginFusioninventoryDeployOrder $order)
 {
     global $CFG_GLPI;
     if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
         $pfDeployPackage = new PluginFusioninventoryDeployPackage();
         $pfDeployPackage->getFromDB($order->fields['plugin_fusioninventory_deploypackages_id']);
         // === debug ===
         echo "<span class='red'><b>DEBUG</b></span>";
         echo "<form action='" . $CFG_GLPI["root_doc"] . "/plugins/fusioninventory/front/deploypackage.form.php' method='POST'>";
         echo "<textarea cols='132' rows='25' style='border:0' name='json'>";
         echo PluginFusioninventoryToolbox::formatJson($order->fields['json']);
         echo "</textarea>";
         if ($pfDeployPackage->can($pfDeployPackage->getID(), UPDATE)) {
             echo "<input type='hidden' name='orders_id' value='{$order->fields['id']}' />";
             echo "<input type='submit' name='update_json' value=\"" . _sx('button', 'Save') . "\" class='submit'>";
         }
         Html::closeForm();
         // === debug ===
     }
 }
 /**
  * @test
  */
 public function formatJson()
 {
     $this->assertEquals($this->formatJson_expected, PluginFusioninventoryToolbox::formatJson(json_encode($this->formatJson_input)));
 }