root/trunk/src/main/php/net/stubbles/util/log/stubMemoryLogAppender.php

Revision 1281, 1.5 kB (checked in by mikey, 5 months ago)

code nazi :)

Line 
1 <?php
2 /**
3  * A log appenders that writes log data into the memory.
4  *
5  * @author      Richard Sternagel <richard.sternagel@1und1.de>
6  * @package     stubbles
7  * @subpackage  util_log
8  */
9 stubClassLoader::load('net::stubbles::util::log::stubLogAppender');
10 /**
11  * A log appenders that writes log data into the memory.
12  *
13  * @package     stubbles
14  * @subpackage  util_log
15  */
16 class stubMemoryLogAppender extends stubBaseObject implements stubLogAppender
17 {
18     /**
19      * stores the logged data and represents the storing medium (memory)
20      *
21      * @var  array<string,array<stubLogData>>
22      */
23     protected $logData = array();
24
25     /**
26      * getter method
27      *
28      * @return  array<string,array<stubLogData>>
29      */
30     public function getLogData()
31     {
32         return $this->logData;
33     }
34
35     /**
36      * nothing to configure
37      *
38      * @param  array  $config
39      */
40     public function setConfig(array $config)
41     {
42         // intentionally empty
43     }
44
45     /**
46      * nothing to get because nothing to configure
47      *
48      * @return  array
49      */
50     public function getConfig()
51     {
52         return array();
53     }
54
55     /**
56      * append the log data to the log.
57      * the target is used for the key.
58      *
59      * @param  stubLogData  $logData
60      */
61     public function append(stubLogData $logData)
62     {
63         $this->logData[$logData->getTarget()][] = $logData;
64     }
65
66     /**
67      * finalize the log target
68      */
69     public function finalize()
70     {
71         unset($this->logData);
72     }
73 }
74 ?>
Note: See TracBrowser for help on using the browser.