diff options
| author | spiderr <spiderr@bitweaver.org> | 2020-06-20 11:24:23 -0400 |
|---|---|---|
| committer | spiderr <spiderr@bitweaver.org> | 2020-06-20 11:24:23 -0400 |
| commit | a3767ca7f774d0ec28b2b4a73bd18339a2c1a8e0 (patch) | |
| tree | 77b6120d8719de3a176f7f288cf73bff9b4da870 | |
| parent | 95c8cd22ad55c60a3fdd05b20c9ba44fc2c07821 (diff) | |
| download | kernel-a3767ca7f774d0ec28b2b4a73bd18339a2c1a8e0.tar.gz kernel-a3767ca7f774d0ec28b2b4a73bd18339a2c1a8e0.tar.bz2 kernel-a3767ca7f774d0ec28b2b4a73bd18339a2c1a8e0.zip | |
query debug output html vs plain
| -rw-r--r-- | BitBase.php | 4 | ||||
| -rw-r--r-- | BitDbBase.php | 14 |
2 files changed, 11 insertions, 7 deletions
diff --git a/BitBase.php b/BitBase.php index ccdf176..67cc925 100644 --- a/BitBase.php +++ b/BitBase.php @@ -346,8 +346,8 @@ abstract class BitBase { } function debugOutput( $pString ) { - global $gDebug; - if( $gDebug || !defined( 'IS_LIVE' ) || !IS_LIVE ) { + global $gDebug, $gArgs, $argv; + if( $gDebug || !defined( 'IS_LIVE' ) || !IS_LIVE || !empty( $gArgs['log'] ) ) { if( empty( $this->mLastOutputTime ) ) { $elapsed = (float)0.000; } else { diff --git a/BitDbBase.php b/BitDbBase.php index 64376b9..65d2246 100644 --- a/BitDbBase.php +++ b/BitDbBase.php @@ -233,11 +233,15 @@ class BitDb { $this->mQueryTime += $interval; if( $this->getDebugLevel() ) { $style = ( $interval > .5 ) ? 'color:red;' : (( $interval > .15 ) ? 'color:orange;' : ''); - $querySpeed = ( $interval > .5 ) ? tra( 'VERY SLOW' ): (( $interval > .15 ) ? tra( 'SLOW' ) : 'complete'); - print '<p style="'.$style.'"> - <span style="display:inline-block;width:30%">### Query: <strong>'.$gNumQueries.'</strong> '.$querySpeed.'</span> - <span style="display:inline-block;width:33%">Start time: '.round( $this->mQueryLap, 5 ).'</span> - <span style="display:inline-block;width:33%">### Query run time: '.round( $interval, 5 ).'</span></p>'; + $querySpeed = ( $interval > .5 ) ? tra( 'VERY SLOW' ): (( $interval > .15 ) ? tra( 'SLOW' ) : 'NORMAL'); + if( ini_get( 'html_errors' ) ) { + print '<p style="'.$style.'"> + <span style="display:inline-block;width:30%">### Query: <strong>'.$gNumQueries.'</strong> '.$querySpeed.'</span> + <span style="display:inline-block;width:33%">Start time: '.round( $this->mQueryLap, 5 ).'</span> + <span style="display:inline-block;width:33%">### Query run time: '.round( $interval, 5 ).'</span></p>'; + } else { + print '('.$this->mDb->databaseType."): #$gNumQueries >> Start: ".round( $this->mQueryLap, 5 )."s > $querySpeed ".round( $interval, 5 )."s\n"; + } flush(); } $this->mQueryLap = 0; |
