From 7cb9e665e9a5be7a30129976f880b5ffe4cfd521 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Tue, 22 May 2012 13:41:04 +0000 Subject: [PATCH] colourize sql/rrd debugging yellow/green git-svn-id: http://www.observium.org/svn/observer/trunk@3224 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/dbFacile.php | 6 +++++- includes/rrdtool.inc.php | 13 ++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/includes/dbFacile.php b/includes/dbFacile.php index e1881de05f..1f98bc1c97 100644 --- a/includes/dbFacile.php +++ b/includes/dbFacile.php @@ -24,7 +24,11 @@ Usage function dbQuery($sql, $parameters = array()) { global $fullSql, $debug; $fullSql = dbMakeQuery($sql, $parameters); - if($debug) { echo("\nSQL[".$fullSql."] "); } + if($debug) { + print Console_Color::convert("\nSQL[%y".$fullSql."%n] "); + #echo("\nSQL[".$fullSql."] "); + } + /* if($this->logFile) $time_start = microtime(true); diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php index 4c455ad692..5cde0d6ed0 100644 --- a/includes/rrdtool.inc.php +++ b/includes/rrdtool.inc.php @@ -155,7 +155,7 @@ function rrdtool($command, $filename, $options) if ($config['norrd']) { - print Console_Color::convert("%g RRD Disabled %n", false); + print Console_Color::convert("[%rRRD Disabled%n]"); } else { fwrite($rrd_pipes[0], $cmd."\n"); } @@ -163,10 +163,7 @@ function rrdtool($command, $filename, $options) { echo stream_get_contents($rrd_pipes[1]); echo stream_get_contents($rrd_pipes[2]); - - echo("

"); - echo("\n".$cmd."\n"); - echo("

"); + print Console_Color::convert("RRD[%g".$cmd."%n] "); } else { $tmp = stream_get_contents($rrd_pipes[1]).stream_get_contents($rrd_pipes[2]); } @@ -186,15 +183,13 @@ function rrdtool_create($filename, $options) if ($config['norrd']) { - print Console_Color::convert("%g RRD Disabled %n", false); + print Console_Color::convert("[%gRRD Disabled%n] ", false); } else { $command = $config['rrdtool'] . " create $filename $options"; } - if ($debug) { echo($command."\n"); } + if ($debug) { print Console_Color::convert("RRD[%g".$command."%n] "); } return shell_exec($command); - -# return rrdtool("create", $filename, $options); } function rrdtool_update($filename, $options)