cake/libs/cake_log.php
/**
 * Writes given message to a log file in the logs directory.
 *
 * @param string $type Type of log, becomes part of the log's filename
 * @param string $msg  Message to log
 * @return boolean Success
 * @access public
 */
Writes given message to a log file in the logs directory.
@param string $type Type of log, becomes part of the log's filename
@param string $msg  Message to log
@return boolean Success
@access public
Writes given message to a log file in the logs directory . @param string $type Type of log becomes part of the log ' s filename @param string $msg Message to log @return boolean Success @access public
function write($type, $msg) {
		if (!defined('LOG_ERROR')) {
			define('LOG_ERROR', 2);
		}
		if (!defined('LOG_ERR')) {
			define('LOG_ERR', LOG_ERROR);
		}
		$levels = array(
			LOG_WARNING => 'warning',
			LOG_NOTICE => 'notice',
			LOG_INFO => 'info',
			LOG_DEBUG => 'debug',
			LOG_ERR => 'error',
			LOG_ERROR => 'error'
		);
		if (is_int($type) && isset($levels[$type])) {
			$type = $levels[$type];
		}
		if ($type == 'error' || $type == 'warning') {
			$filename = LOGS . 'error.log';
		} elseif (in_array($type, $levels)) {
			$filename = LOGS . 'debug.log';
		} else {
			$filename = LOGS . $type . '.log';
		}
		$output = date('Y-m-d H:i:s') . ' ' . ucfirst($type) . ': ' . $msg . "\n";
		$log = new File($filename, true);
		if ($log->writable()) {
			return $log->append($output);
		}
	}
function write ( $ type , $ msg ) { if ( ! defined ( 'LOG_ERROR' ) ) { define ( 'LOG_ERROR' , 2 ) ; } if ( ! defined ( 'LOG_ERR' ) ) { define ( 'LOG_ERR' , LOG_ERROR ) ; } $ levels = array ( LOG_WARNING => 'warning' , LOG_NOTICE => 'notice' , LOG_INFO => 'info' , LOG_DEBUG => 'debug' , LOG_ERR => 'error' , LOG_ERROR => 'error' ) ; if ( is_int ( $ type ) && isset ( $ levels [ $ type ] ) ) { $ type = $ levels [ $ type ] ; } if ( $ type == 'error' || $ type == 'warning' ) { $ filename = LOGS . 'error.log' ; } elseif ( in_array ( $ type , $ levels ) ) { $ filename = LOGS . 'debug.log' ; } else { $ filename = LOGS . $ type . '.log' ; } $ output = date ( 'Y-m-d H:i:s' ) . ' ' . ucfirst ( $ type ) . ': ' . $ msg . " \n " ; $ log = new File ( $ filename , true ) ; if ( $ log -> writable ( ) ) { return $ log -> append ( $ output ) ; } }
Writes given message to a log file in the logs directory.
Writes given message to a log file in the logs directory .