1 | --TEST-- |
---|
2 | Log: Display Handler |
---|
3 | --FILE-- |
---|
4 | <?php |
---|
5 | |
---|
6 | require_once 'Log.php'; |
---|
7 | |
---|
8 | function test($name, $conf) |
---|
9 | { |
---|
10 | echo "\nTesting $name Configuration\n"; |
---|
11 | echo "------------------------------------------------------\n"; |
---|
12 | |
---|
13 | $logger = &Log::factory('display', '', $name, $conf); |
---|
14 | |
---|
15 | $logger->log("Info", PEAR_LOG_INFO); |
---|
16 | $logger->log("Error", PEAR_LOG_ERR); |
---|
17 | $logger->log("Debug", PEAR_LOG_DEBUG); |
---|
18 | $logger->log("Multi\nLine\nEntry", PEAR_LOG_INFO); |
---|
19 | |
---|
20 | echo "\n"; |
---|
21 | } |
---|
22 | |
---|
23 | test('Default', array()); |
---|
24 | test('Line Break', array('linebreak' => "\n")); |
---|
25 | test('Format', array('lineFormat' => '<!-- %4$s -->')); |
---|
26 | test('Prepend / Append', array('error_prepend' => '<tt>', |
---|
27 | 'error_append' => '</tt>')); |
---|
28 | |
---|
29 | --EXPECT-- |
---|
30 | Testing Default Configuration |
---|
31 | ------------------------------------------------------ |
---|
32 | <b>info</b>: Info<br /> |
---|
33 | <b>error</b>: Error<br /> |
---|
34 | <b>debug</b>: Debug<br /> |
---|
35 | <b>info</b>: Multi<br /> |
---|
36 | Line<br /> |
---|
37 | Entry<br /> |
---|
38 | |
---|
39 | |
---|
40 | Testing Line Break Configuration |
---|
41 | ------------------------------------------------------ |
---|
42 | <b>info</b>: Info |
---|
43 | <b>error</b>: Error |
---|
44 | <b>debug</b>: Debug |
---|
45 | <b>info</b>: Multi<br /> |
---|
46 | Line<br /> |
---|
47 | Entry |
---|
48 | |
---|
49 | |
---|
50 | Testing Format Configuration |
---|
51 | ------------------------------------------------------ |
---|
52 | <!-- Info --><br /> |
---|
53 | <!-- Error --><br /> |
---|
54 | <!-- Debug --><br /> |
---|
55 | <!-- Multi<br /> |
---|
56 | Line<br /> |
---|
57 | Entry --><br /> |
---|
58 | |
---|
59 | |
---|
60 | Testing Prepend / Append Configuration |
---|
61 | ------------------------------------------------------ |
---|
62 | <tt><b>info</b>: Info</tt><br /> |
---|
63 | <tt><b>error</b>: Error</tt><br /> |
---|
64 | <tt><b>debug</b>: Debug</tt><br /> |
---|
65 | <tt><b>info</b>: Multi<br /> |
---|
66 | Line<br /> |
---|
67 | Entry</tt><br /> |
---|