Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
	/**
4
	 * $Id: LogWriter.php 325 2007-12-20 15:44:58Z hans $
5
	 *
6
	 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
7
	 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
8
	 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9
	 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
10
	 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
11
	 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
12
	 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
13
	 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
14
	 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
15
	 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
16
	 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17
	 *
18
	 * This software consists of voluntary contributions made by many individuals
19
	 * and is licensed under the LGPL. For more information please see
20
	 * <http://phing.info>.
21
	 */
22
 
23
	require_once 'phing/system/io/Writer.php';
24
	require_once 'phing/Task.php';
25
 
26
	/**
27
	 * Extends the Writer class to output messages to Phing's log
28
	 *
29
	 * @author Michiel Rook <michiel.rook@gmail.com>
30
	 * @version $Id: LogWriter.php 325 2007-12-20 15:44:58Z hans $
31
	 * @package phing.util
32
	 */
33
	class LogWriter extends Writer
34
	{
35
		private $task = NULL;
36
 
37
		private $level = NULL;
38
 
39
		/**
40
		 * Constructs a new LogWriter object
41
		 */
42
		function __construct(Task $task, $level = Project::MSG_INFO)
43
		{
44
			$this->task = $task;
45
			$this->level = $level;
46
		}
47
 
48
		/**
49
		 * @see Writer::write()
50
		 */
51
		function write($buf, $off = null, $len = null)
52
		{
53
			$lines = explode("\n", $buf);
54
 
55
			foreach ($lines as $line)
56
			{
57
				if ($line == "")
58
				{
59
					continue;
60
				}
61
 
62
				$this->task->log($line, $this->level);
63
			}
64
		}
65
 
66
		/**
67
		 * @see Writer::reset()
68
		 */
69
		function reset()
70
		{
71
		}
72
 
73
		/**
74
		 * @see Writer::close()
75
		 */
76
		function close()
77
		{
78
		}
79
 
80
		/**
81
		 * @see Writer::open()
82
		 */
83
		function open()
84
		{
85
		}
86
 
87
		/**
88
		 * @see Writer::getResource()
89
		 */
90
		function getResource()
91
		{
92
			return $this->task;
93
		}
94
	}
95