Public Member Functions | |
error ($msg, $title=null) | |
Log a Error Level Message. | |
debug ($msg, $title=null, $udebug=false) | |
Log a Debug Level Message. | |
hr () | |
Draws a Horizontal Line on The Log using '=' sign. | |
udebug ($msg, $title=null) | |
Log an User Debug Level Message. | |
udebugOn () | |
udebugOff () | |
Private Member Functions | |
commit ($udebug=false) | |
Commits the Log data to a Media (File | tty | SocketClient). | |
release () | |
Gets called at the very end to Complete the Logging Process. |
etc/zig.ini.php
File in your Project's Directory there you will find [log]
Directive for configuring Logging. Configuring Logger ------------------- Z_LOG_LEVEL => Logging Level 0 -> Loging is Disabled 1 -> Log Only Errors 2 -> Log Both Debug and Error -->> There is No option for Debug only Logs cause you must see the error Logs Z_LOG_MEDIA => Where to Log file -> Log to file. tty -> TTY Level Logging (Only on *nix system) socket -> Socket Level Logging Z_LOG_DATE => date pattern in Log.file Name (if media is file) Z_LOG_STAMP_TIME => Time Stamp pattrn default is "H:i:s" Z_LOG_STAMP_DATE => Date Stamp default is "M d Y D" Z_LOG_TTY => tty Name e.g. /dev/pts/2 (The Name might vary System To System) put the tty Name here when tty media is used. Z_LOG_SOCK_HOST => Socket Host of the Log Client Applicable when used socket media Z_LOG_SOCK_PORT => Socket Port defaults to 9999 Applicable when used socket media Z_LOG_SOCK_TIMEOUT => Timeout on socket level logging defaults to 10; Z_LOG_UDEBUG => User debug off by default. If set to on only your Error/debug messages will be shown PHP's Own Internal Debug messages will not be shown.
Definition at line 59 of file logger.php.
zLogger::error | ( | $ | msg, | |
$ | title = null | |||
) |
Log a Error Level Message.
$msg | string Error Message | |
$title | string Optional message Title |
Definition at line 66 of file logger.php.
References $GLOBALS, commit(), and zDef::get().
Referenced by zQuery::__construct(), zLogClient::__construct(), zDynOrm::colList(), zDbAccess::colList(), zSocketClient::connect(), zSocketClient::isConnectable(), mediaRouter::readFile(), and mediaRouter::sendContentType().
00066 { 00067 $logBuffer =& $GLOBALS['____zigmoyd__Internal____Logg__Buffer____']; 00068 $logBuffer[] = array( 'type' => 'error', 00069 'title' => $title, 00070 'msg' => $msg, 00071 'timestamp' => time(), 00072 'time' => date(zDef::get('Z_LOG_STAMP_TIME')), 00073 'date' => date(zDef::get('Z_LOG_STAMP_DATE')) 00074 ); 00075 zLogger::commit(); 00076 }
zLogger::debug | ( | $ | msg, | |
$ | title = null , |
|||
$ | udebug = false | |||
) |
Log a Debug Level Message.
$msg | string Debug Message | |
$title | string Optional message Title |
Definition at line 83 of file logger.php.
References $GLOBALS, commit(), and zDef::get().
Referenced by zQuery::__construct(), zOrm_core::attachDriver(), zigController::cacheExists(), zDynOrm::colList(), zDbAccess::colList(), zSession::commit(), zigController::commitViews(), zSocketClient::connect(), zOrm_noMagic::crossJoin(), zOrm_base::delete(), zSocketClient::disconnect(), zOrm_base::distinct(), zOrm_core::exec(), zigController::execCache(), OrmDriver_mysql::execute(), zOrm_base::export(), zOrm_noMagic::forceJoin(), zSession::getEncrypted(), zCookie::getEncrypted(), OrmDriver_mysql::getForeignKey(), zSession::getPlain(), zCookie::getPlain(), OrmDriver_mysql::getPrimaryKey(), zSession::Id(), zOrm_base::index(), zOrm_core::init(), zOrm_core::initLex(), zRom_upload::initValidator(), zRom_form::initValidator(), zOrm_noMagic::innerJoin(), zOrm_base::insert(), zOrm_noMagic::join(), zCookie::keyExists(), zOrm_noMagic::leftJoin(), zigController::loadSharedView(), zigController::loadView(), zSession::Name(), zSession::regenerateId(), zSession::remove(), zCookie::remove(), zOrm_base::remove(), zigController::renderSharedView(), zigController::renderView(), zOrm_noMagic::rightJoin(), zSession::setEncrypted(), zCookie::setEncrypted(), zSession::setPlain(), zCookie::setPlain(), zCookie::setRaw(), zSession::start(), zSession::started(), udebug(), zOrm_base::update(), and upload::validate().
00083 { 00084 $logBuffer =& $GLOBALS['____zigmoyd__Internal____Logg__Buffer____']; 00085 $logBuffer[] = array( 'type' => 'debug', 00086 'title' => $title, 00087 'msg' => $msg, 00088 'timestamp' => time(), 00089 'time' => date(zDef::get('Z_LOG_STAMP_TIME')), 00090 'date' => date(zDef::get('Z_LOG_STAMP_DATE')) 00091 ); 00092 zLogger::commit($udebug); 00093 }
zLogger::hr | ( | ) |
Draws a Horizontal Line on The Log using '=' sign.
Definition at line 98 of file logger.php.
References $GLOBALS, commit(), and zDef::get().
00098 { 00099 $logBuffer =& $GLOBALS['____zigmoyd__Internal____Logg__Buffer____']; 00100 $logBuffer[] = array( 'type' => 'debug', 00101 'title' => '==================', 00102 'msg' => '=============================================', 00103 'timestamp' => time(), 00104 'time' => date(zDef::get('Z_LOG_STAMP_TIME')), 00105 'date' => date(zDef::get('Z_LOG_STAMP_DATE')) 00106 ); 00107 zLogger::commit(); 00108 }
zLogger::commit | ( | $ | udebug = false |
) | [private] |
Commits the Log data to a Media (File | tty | SocketClient).
Definition at line 113 of file logger.php.
References $GLOBALS, zDef::get(), and perror().
Referenced by debug(), error(), hr(), and release().
00113 { 00114 isset($GLOBALS['____zigmoyd__Internal__Logg__Debug__File__Handle____']) ? $debugLogHandle =& $GLOBALS['____zigmoyd__Internal__Logg__Debug__File__Handle____'] : false; 00115 isset($GLOBALS['____zigmoyd__Internal__Logg__Error__File__Handle____']) ? $errorLogHandle =& $GLOBALS['____zigmoyd__Internal__Logg__Error__File__Handle____'] : false; 00116 $logBuffer =& $GLOBALS['____zigmoyd__Internal____Logg__Buffer____']; 00117 if(zDef::get('Z_LOG_LEVEL') != 0){ 00118 switch(zDef::get('Z_LOG_MEDIA')){ 00119 case 'file': 00120 if(zDef::get('Z_LOG_AUTOCOMMIT')){ 00121 foreach($logBuffer as $logObj){ 00122 $str = "\"$logObj[timestamp]\",\"$logObj[time]\",\"$logObj[date]\",\"$logObj[title]\",\"$logObj[msg]\"\n"; 00123 if($logObj['type'] == 'error'){ 00124 //if(fwrite($errorLogHandle, '"ERROR",'.$str) === false){ 00125 if(fwrite($errorLogHandle, $str) === false){ 00126 perror('<code>zigmoyd.log</code><br />failed to Log Error Message in error Log File'); 00127 } 00128 //if(fwrite($debugLogHandle, '"ERROR",'.$str) === false){ 00129 //if(fwrite($debugLogHandle, $str) === false){ 00130 // perror('<code>zigmoyd.log</code><br />failed to Log Error Message in Debug Log File'); 00131 //} 00132 }else{ 00133 if(zDef::get('Z_LOG_LEVEL') == 2){//Log debug Level Messages only if Log Level is 2 00134 if(fwrite($debugLogHandle, $str) === false){ 00135 perror('<code>zigmoyd.log</code><br />failed to Log Debug Message'); 00136 } 00137 } 00138 } 00139 } 00140 } 00141 break; 00142 case 'tty': 00143 if(PHP_OS == "WINNT")trigger_error('TTY Level Logging is Is Not aviliable under Windows', E_USER_NOTICE); 00144 foreach($logBuffer as $logObj){ 00145 //$str = "$logObj[timestamp] $logObj[time] $logObj[date] $logObj[title] \t $logObj[msg]\n"; 00146 if(($GLOBALS['__log_udebug'] && $udebug) || (!$GLOBALS['__log_udebug'])){ 00147 if($logObj['type'] == 'error'){ 00148 $str = "\033[35m$logObj[time]\033[0m \033[31m$logObj[title]\033[0m \t\t \033[5;30m\033[48m$logObj[msg]\033[0m"; 00149 if(shell_exec("echo '$str' > ".zDef::get('Z_LOG_TTY'))){ 00150 perror('<code>zigmoyd.log</code><br />failed to Log Error Message'); 00151 } 00152 }else{ 00153 if(zDef::get('Z_LOG_LEVEL') == 2){//Log debug Level Messages only if Log Level is 2 00154 $str = "\033[35m$logObj[time]\033[0m \033[32m$logObj[title]\033[0m \t\t \033[34m$logObj[msg]\033[0m"; 00155 if(shell_exec("echo '$str' > ".zDef::get('Z_LOG_TTY'))){ 00156 perror('<code>zigmoyd.log</code><br />failed to Log Debug Message '); 00157 } 00158 } 00159 } 00160 } 00161 } 00162 $logBuffer = array();//Flush the Buffer Array 00163 break; 00164 case 'socket': 00165 if(!isset($logHandle) || !is_object($logHandle))$logHandle =& $GLOBALS['____zigmoyd__Internal__Logg__socket__obj____']; 00166 if(($GLOBALS['__log_udebug'] && $udebug) || (!$GLOBALS['__log_udebug'])){ 00167 foreach($logBuffer as $logObj){ 00168 if($logObj['type'] == 'error'){ 00169 if(is_object($logHandle))$logHandle->write($logObj); 00170 }else{ 00171 if((zDef::get('Z_LOG_LEVEL') == 2)){ 00172 if(is_object($logHandle))$logHandle->write($logObj); 00173 } 00174 } 00175 } 00176 } 00177 $logBuffer = array();//Flush the Buffer Array 00178 break; 00179 default: 00180 perror('<code>zigmoyd.log</code><br />Invalid Log media (Z_LOG_MEDIA) "'.zDef::get('Z_LOG_MEDIA')); 00181 exit; 00182 } 00183 } 00184 }
zLogger::release | ( | ) | [private] |
Gets called at the very end to Complete the Logging Process.
Definition at line 189 of file logger.php.
References $GLOBALS, commit(), zDef::get(), and zDef::set().
00189 { 00190 $debugLogHandle =& $GLOBALS['____zigmoyd__Internal__Logg__Debug__File__Handle____']; 00191 $errorLogHandle =& $GLOBALS['____zigmoyd__Internal__Logg__Error__File__Handle____']; 00192 if((zDef::get('Z_LOG_LEVEL') != 0) && !zDef::get('Z_LOG_AUTOCOMMIT')){ 00193 zDef::set('Z_LOG_AUTOCOMMIT', true); 00194 zLogger::commit(); 00195 zDef::set('Z_LOG_AUTOCOMMIT', false); 00196 is_resource($errorLogHandle) ? fclose($errorLogHandle) : false; 00197 is_resource($debugLogHandle) ? fclose($debugLogHandle) : false; 00198 } 00199 }
zLogger::udebug | ( | $ | msg, | |
$ | title = null | |||
) |
Log an User Debug Level Message.
$msg | string Debug Message | |
$title | string Optional message Title |
Definition at line 206 of file logger.php.
References debug().
Referenced by zOrm_base::isValidUpdate().
00206 { 00207 zLogger::debug($msg, $title, true); 00208 }
zLogger::udebugOn | ( | ) |
Turns uDebug On
Definition at line 212 of file logger.php.
References $GLOBALS.
00212 { 00213 $GLOBALS['__log_udebug'] = true; 00214 }
zLogger::udebugOff | ( | ) |
Turns uDebug off
Definition at line 218 of file logger.php.
References $GLOBALS.
00218 { 00219 $GLOBALS['__log_udebug'] = false; 00220 }