mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 19:38:26 +00:00
6460f6e83f
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@342 3807eeeb-6ff5-0310-8944-8be069107fe0
76 lines
No EOL
2.1 KiB
PHP
76 lines
No EOL
2.1 KiB
PHP
<?php
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// + $Id $
|
|
// +------------------------------------------------------------------+ //
|
|
// + Cake PHP : 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. + //
|
|
// + See: http://www.opensource.org/licenses/mit-license.php + //
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
/**
|
|
* Purpose: Log
|
|
* Logs messages to text files.
|
|
*
|
|
* @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 1.0.0.0
|
|
* @version $Revision$
|
|
* @modifiedby $LastChangedBy$
|
|
* @lastmodified $Date$
|
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
|
*/
|
|
uses('file');
|
|
|
|
/**
|
|
* Enter description here...
|
|
*
|
|
* @package cake
|
|
* @subpackage cake.libs
|
|
* @since CakePHP v 0.2.9
|
|
*/
|
|
class Log
|
|
{
|
|
/**
|
|
* Enter description here...
|
|
*
|
|
* @param unknown_type $type
|
|
* @param unknown_type $msg
|
|
* @return unknown
|
|
*/
|
|
function write($type, $msg)
|
|
{
|
|
$filename = LOGS.$type.'.log';
|
|
$output = date('y-m-d H:i:s').' '.ucfirst($type).': '.$msg."\n";
|
|
|
|
$log = new File($filename);
|
|
return $log->append($output);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Error constant. Used for differentiating error logging and debugging.
|
|
* Currently PHP supports LOG_DEBUG
|
|
*/
|
|
define ('LOG_ERROR', 2);
|
|
|
|
/**
|
|
* Shortcut.
|
|
*/
|
|
function LogError ($message)
|
|
{
|
|
$bad = array("\n", "\r", "\t");
|
|
$good = ' ';
|
|
Log::write('error', str_replace($bad, $good, $message));
|
|
}
|
|
|
|
?>
|