File: priority.phpt

package info (click to toggle)
php-log 1.10.0-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 404 kB
  • ctags: 592
  • sloc: php: 1,822; xml: 237; sql: 8; makefile: 3
file content (30 lines) | stat: -rw-r--r-- 727 bytes parent folder | download | duplicates (3)
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
--TEST--
Log: Priorities
--FILE--
<?php

require_once 'Log.php';

$conf = array('lineFormat' => '[%3$s] %4$s');
$logger = &Log::singleton('console', '', 'ident', $conf);

/* Log at the default PEAR_LOG_INFO level. */
$logger->log('Log message');

/* Set the default priority to PEAR_LOG_DEBUG. */
$logger->setPriority(PEAR_LOG_DEBUG);
$logger->log('Log message');

/* Verify that the getPriority() method also things we're at PEAR_LOG_DEBUG. */
$priority = $logger->priorityToString($logger->getPriority());
echo "$priority\n";

/* Verify that stringToPriority() can convert back to a constant. */
$priority = $logger->stringToPriority($priority);
echo "$priority\n";

--EXPECT--
[info] Log message
[debug] Log message
debug
7