-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhpAppFormatDescriptor.php
39 lines (35 loc) · 1.23 KB
/
PhpAppFormatDescriptor.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
namespace phpWTL;
use phpWTL\aBasicFormatDescriptor;
require_once 'aBasicFormatDescriptor.php';
/**
* Format descriptor for PHP event/error/exception logging.
*
* @author Michael Beyer <[email protected]>
* @version v0.1.2
* @api
*/
class PhpAppFormatDescriptor extends aBasicFormatDescriptor {
/**
* Set format prefix and create all format field descriptors in their proper sequence (array of DescriptorField objects):
*
* timestamp, message, loglevel_caption, loglevel, context_data
*
* @param object|null $inject Can be used to inject one or more parameter(s) into the constructor
*
* @author Michael Beyer <[email protected]>
* @version v0.1.2
*/
protected function __construct($inject= null) {
static::$formatPrefix= "php_";
static::$formatFieldDelimiter= " ";
static::$formatFields= array(
new DescriptorField(array('name' => 'timestamp', 'formatter' => '%Y-%m-%d %H:%M:%S', 'datatype_raw' => 'datetime')),
new DescriptorField(array('name' => 'message')),
new DescriptorField(array('name' => 'loglevel_caption')),
new DescriptorField(array('name' => 'loglevel', 'datatype_raw' => 'integer')),
new DescriptorField(array('name' => 'context_data', 'datatype_raw' => 'text')),
);
}
}
?>