Changeset 23
- Timestamp:
- 02/14/06 16:12:46 (3 years ago)
- Files:
-
- trunk/classes/phing/tasks/system/EchoTask.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/classes/phing/tasks/system/EchoTask.php
r1 r23 23 23 24 24 /** 25 * Echos a message to all output devices25 * Echos a message to the logging system or to a file 26 26 * 27 * @author Michiel Rook <michiel@trendserver.nl> 27 28 * @author Andreas Aderhold, andi@binarycloud.com 28 29 * @version $Revision: 1.5 $ $Date: 2003/12/24 13:02:09 $ … … 31 32 32 33 class EchoTask extends Task { 34 35 protected $msg = ""; 36 37 protected $file = ""; 38 39 protected $append = false; 40 41 protected $level = "warning"; 33 42 34 protected $msg; 43 function main() { 44 switch ($this->level) 45 { 46 case "error": $loglevel = PROJECT_MSG_ERR; break; 47 case "warning": $loglevel = PROJECT_MSG_WARN; break; 48 case "info": $loglevel = PROJECT_MSG_INFO; break; 49 case "verbose": $loglevel = PROJECT_MSG_VERBOSE; break; 50 case "debug": $loglevel = PROJECT_MSG_DEBUG; break; 51 } 52 53 if (empty($this->file)) 54 { 55 $this->log($this->msg, $loglevel); 56 } 57 else 58 { 59 if ($this->append) 60 { 61 $handle = fopen($this->file, "a"); 62 } 63 else 64 { 65 $handle = fopen($this->file, "w"); 66 } 67 68 fwrite($handle, $this->msg); 69 70 fclose($handle); 71 } 72 } 73 74 /** setter for file */ 75 function setFile($file) 76 { 77 $this->file = (string) $file; 78 } 35 79 36 function main() { 37 $this->log($this->msg); 38 } 80 /** setter for level */ 81 function setLevel($level) 82 { 83 $this->level = (string) $level; 84 } 85 86 /** setter for append */ 87 function setAppend($append) 88 { 89 $this->append = $append; 90 } 39 91 40 92 /** setter for message */
