2
Log: _extractMessage() [Zend Engine 1]
4
<?php if (version_compare(zend_version(), "2.0.0", ">=")) die('skip'); ?>
8
require_once 'Log.php';
10
$conf = array('lineFormat' => '%2$s [%3$s] %4$s');
11
$logger = &Log::singleton('console', '', 'ident', $conf);
13
/* Logging a regular string. */
14
$logger->log('String');
16
/* Logging a bare object. */
18
$logger->log(new BareObject());
20
/* Logging an object with a getMessage() method. */
21
class GetMessageObject { function getMessage() { return "getMessage"; } }
22
$logger->log(new GetMessageObject());
24
/* Logging an object with a toString() method. */
25
class ToStringObject { function toString() { return "toString"; } }
26
$logger->log(new ToStringObject());
28
/* Logging a PEAR_Error object. */
29
require_once 'PEAR.php';
30
$logger->log(new PEAR_Error('PEAR_Error object', 100));
32
/* Logging an array. */
33
$logger->log(array(1, 2, 'three' => 3));
35
/* Logging an array with a 'message' key. */
36
$logger->log(array('message' => 'Message Key'));
40
ident [info] bareobject Object
44
ident [info] getMessage
46
ident [info] PEAR_Error object
54
ident [info] Message Key