FRED™  3.0
FRED™: Framework for Rapid and Easy Development
Handler.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Rsi\Fred\Log;
4 
5 abstract class Handler extends \Rsi\Thing{
6 
7  protected $_log;
8  protected $_config = null;
9  protected $_name = null;
10 
11  public function __construct($log,$config,$name = null){
12  $this->_log = $log;
13  $this->_name = $name;
14  $this->publish('name');
15  $this->configure($this->_config = $config);
16  $this->init();
17  }
18 
19  protected function init(){
20  }
21 
22  abstract public function add($prio,$message,$context);
23  /**
24  * Unique period messages within a period.
25  * @param int $start Timestamp for start of period.
26  * @param int $end Timestamp for end of period (empty = now).
27  * @return array Unique messages.
28  */
29  public function periodMessages($start,$end = null){
30  return [];
31  }
32  /**
33  * Periods for a messages within a period.
34  * @param string $message
35  * @param int $start Timestamp for start of period.
36  * @param int $end Timestamp for end of period (empty = now).
37  * @return array Array of records (in chronological order) with 'start', (optional) 'end' timestamp, and (optional) points
38  * array (records with time and message).
39  */
40  public function periods($message,$start,$end = null){
41  return [];
42  }
43 
44 }
Rsi\Thing
Basic object.
Definition: Thing.php:13
Rsi\Fred\Log\Handler\__construct
__construct($log, $config, $name=null)
Definition: Handler.php:11
Rsi\Fred\Log\Handler\$_name
$_name
Definition: Handler.php:9
Rsi\Fred\Log\Handler\$_config
$_config
Definition: Handler.php:8
Rsi\Fred\Log
Rsi\Fred\Log\Handler\periods
periods($message, $start, $end=null)
Periods for a messages within a period.
Definition: Handler.php:40
Rsi\Fred\Log\Handler\periodMessages
periodMessages($start, $end=null)
Unique period messages within a period.
Definition: Handler.php:29
Rsi\Thing\configure
configure($config)
Configure the object.
Definition: Thing.php:55
Rsi\Thing\publish
publish($property, $visibility=self::READABLE)
Publish a property (or hide it again).
Definition: Thing.php:28
Rsi\Fred\Log\Handler\init
init()
Definition: Handler.php:19
Rsi\Fred\Log\Handler\add
add($prio, $message, $context)
Rsi\Fred\Log\Handler
Definition: Handler.php:5
Rsi\Fred\Log\Handler\$_log
$_log
Definition: Handler.php:7