2005-07-04 01:07:14 +00:00
|
|
|
<?php
|
2005-08-21 06:49:02 +00:00
|
|
|
/* SVN FILE: $Id$ */
|
2005-05-21 22:40:51 +00:00
|
|
|
|
2005-05-21 22:51:26 +00:00
|
|
|
/**
|
2005-08-21 06:49:02 +00:00
|
|
|
* Short description for file.
|
|
|
|
*
|
|
|
|
* Long description for file
|
|
|
|
*
|
|
|
|
* PHP versions 4 and 5
|
|
|
|
*
|
|
|
|
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
|
|
|
|
* Copyright (c) 2005, CakePHP Authors/Developers
|
|
|
|
*
|
|
|
|
* Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com>
|
|
|
|
* Larry E. Masters aka PhpNut <nut@phpnut.com>
|
|
|
|
* Kamil Dzielinski aka Brego <brego.dk@gmail.com>
|
|
|
|
*
|
|
|
|
* Licensed under The MIT License
|
|
|
|
* Redistributions of files must retain the above copyright notice.
|
|
|
|
*
|
|
|
|
* @filesource
|
|
|
|
* @author CakePHP Authors/Developers
|
|
|
|
* @copyright Copyright (c) 2005, CakePHP Authors/Developers
|
|
|
|
* @link https://trac.cakephp.org/wiki/Authors Authors/Developers
|
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.libs
|
|
|
|
* @since CakePHP v 0.2.9
|
|
|
|
* @version $Revision$
|
|
|
|
* @modifiedby $LastChangedBy$
|
|
|
|
* @lastmodified $Date$
|
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enter description here...
|
2005-05-21 22:51:26 +00:00
|
|
|
*/
|
2005-06-19 03:35:19 +00:00
|
|
|
uses('file');
|
2005-07-04 04:30:45 +00:00
|
|
|
|
|
|
|
/**
|
2005-08-21 06:49:02 +00:00
|
|
|
* Logs messages to text files
|
|
|
|
*
|
|
|
|
* Long description for class
|
2005-07-04 04:30:45 +00:00
|
|
|
*
|
2005-08-21 06:49:02 +00:00
|
|
|
* @package cake
|
2005-07-04 04:30:45 +00:00
|
|
|
* @subpackage cake.libs
|
2005-08-21 06:49:02 +00:00
|
|
|
* @since CakePHP v 0.2.9
|
2005-07-04 04:30:45 +00:00
|
|
|
*/
|
2005-06-18 23:26:35 +00:00
|
|
|
class Log
|
|
|
|
{
|
2005-07-04 04:30:45 +00:00
|
|
|
/**
|
|
|
|
* Enter description here...
|
|
|
|
*
|
|
|
|
* @param unknown_type $type
|
|
|
|
* @param unknown_type $msg
|
|
|
|
* @return unknown
|
|
|
|
*/
|
2005-07-10 05:08:19 +00:00
|
|
|
function write($type, $msg)
|
|
|
|
{
|
|
|
|
$filename = LOGS.$type.'.log';
|
|
|
|
$output = date('y-m-d H:i:s').' '.ucfirst($type).': '.$msg."\n";
|
2005-05-21 22:40:51 +00:00
|
|
|
|
2005-07-10 05:08:19 +00:00
|
|
|
$log = new File($filename);
|
|
|
|
return $log->append($output);
|
|
|
|
}
|
2005-05-21 22:40:51 +00:00
|
|
|
}
|
2005-06-18 23:26:35 +00:00
|
|
|
|
2005-06-02 19:37:06 +00:00
|
|
|
/**
|
|
|
|
* Error constant. Used for differentiating error logging and debugging.
|
2005-06-19 03:55:52 +00:00
|
|
|
* Currently PHP supports LOG_DEBUG
|
2005-06-02 19:37:06 +00:00
|
|
|
*/
|
2005-05-21 22:51:26 +00:00
|
|
|
define ('LOG_ERROR', 2);
|
|
|
|
|
2005-06-18 23:26:35 +00:00
|
|
|
/**
|
|
|
|
* Shortcut.
|
|
|
|
*/
|
|
|
|
function LogError ($message)
|
|
|
|
{
|
2005-07-10 05:08:19 +00:00
|
|
|
$bad = array("\n", "\r", "\t");
|
|
|
|
$good = ' ';
|
|
|
|
Log::write('error', str_replace($bad, $good, $message));
|
2005-06-18 23:26:35 +00:00
|
|
|
}
|
|
|
|
|
2005-05-21 22:40:51 +00:00
|
|
|
?>
|