From 3dd8d77b096ad4860e41d631fe2006b9c64c5586 Mon Sep 17 00:00:00 2001 From: pies Date: Sat, 21 May 2005 22:51:26 +0000 Subject: [PATCH] Fixed a bug in log.php and object.php, deleted 'components' dir (it's now 'modules'). git-svn-id: https://svn.cakephp.org/repo/trunk/cake@150 3807eeeb-6ff5-0310-8944-8be069107fe0 --- libs/log.php | 36 ++++++++++++++++++++++++++++++++---- libs/object.php | 2 +- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/libs/log.php b/libs/log.php index 3fd64795b..166912e16 100644 --- a/libs/log.php +++ b/libs/log.php @@ -1,16 +1,44 @@ + // +// + Copyright: (c) 2005, Cake Authors/Developers + // +// + Author(s): Michal Tatarynowicz aka Pies + // +// + Larry E. Masters aka PhpNut + // +// + Kamil Dzielinski aka Brego + // +// +------------------------------------------------------------------+ // +// + 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 Cake Authors/Developers + * @copyright Copyright (c) 2005, Cake Authors/Developers + * @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers + * @package cake + * @subpackage cake.libs + * @since Cake v 1.0.0.0 + * @version $Revision$ + * @modifiedby $LastChangedBy$ + * @lastmodified $Date$ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + */ class Log { function write($type, $msg) { $out = date('y-m-d H:i:s').' '.ucfirst($type).': '.$msg."\r\n"; $fn = LOGS.$type.'.log'; - $log = fopen($fn, 'a+'); - fwrite($log, $out); - fclose($log); + return $log = fopen($fn, 'a+') && fwrite($log, $out) && fclose($log); } - } +define ('LOG_ERROR', 2); + ?> \ No newline at end of file diff --git a/libs/object.php b/libs/object.php index a612937cd..dd5e417e3 100644 --- a/libs/object.php +++ b/libs/object.php @@ -75,7 +75,7 @@ class Object { * @param string $msg * @param string $type */ - function log ($msg, LOG_ERROR) { + function log ($msg, $type=LOG_ERROR) { if (!$this->_log) $this->_log = new Log ();