Revision 795,
1.1 KB
checked in by viani, 15 years ago
(diff) |
Ticket #488 - Inclusão do módulo workflow no ramo trunk do repositório Expresso.
|
-
Property svn:executable set to
*
|
Rev | Line | |
---|
[795] | 1 | <?php |
---|
| 2 | require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'common'.SEP.'Observer.php'); |
---|
| 3 | /** |
---|
| 4 | * Logging class |
---|
| 5 | * |
---|
| 6 | * @package Galaxia |
---|
| 7 | * @license http://www.gnu.org/copyleft/gpl.html GPL |
---|
| 8 | */ |
---|
| 9 | class Logger extends Observer { |
---|
| 10 | /** |
---|
| 11 | * @var string File's full path where logging info will be stored |
---|
| 12 | * @access private |
---|
| 13 | */ |
---|
| 14 | var $_filename; |
---|
| 15 | |
---|
| 16 | /** |
---|
| 17 | * Constructor |
---|
| 18 | * |
---|
| 19 | * @param int $filename |
---|
| 20 | * @return object Logger |
---|
| 21 | * @access public |
---|
| 22 | */ |
---|
| 23 | function Logger($filename) { |
---|
| 24 | $this->_filename = $filename; |
---|
| 25 | $fp = fopen($this->_filename,"a"); |
---|
| 26 | if(!$fp) { |
---|
| 27 | trigger_error("Logger cannot append to log file: ".$this->filename,E_USER_WARNING); |
---|
| 28 | } |
---|
| 29 | if($fp) { |
---|
| 30 | fclose($fp); |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | /** |
---|
| 36 | * Adds content to log file |
---|
| 37 | * |
---|
| 38 | * @param string $event Event that triggered the notify action |
---|
| 39 | * @param string $msg Message about the event |
---|
| 40 | * @access public |
---|
| 41 | * @return void |
---|
| 42 | */ |
---|
| 43 | function notify($event,$msg) { |
---|
| 44 | // Add a line to the log file. |
---|
| 45 | $fp = fopen($this->_filename,"a"); |
---|
| 46 | $date = date("[d/m/Y h:i:s]"); |
---|
| 47 | $msg=trim($msg); |
---|
| 48 | fputs($fp,$date." ".$msg."\n"); |
---|
| 49 | fclose($fp); |
---|
| 50 | } |
---|
| 51 | } |
---|
| 52 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.