Permalink
Browse files

Use factory() in the composite logging examples.

This is apparently more clear than the singleton() pattern.

PEAR Bug 18860
  • Loading branch information...
1 parent 6210a87 commit 5f33eb9db10ebfec9bce356158c954e2beb6ced0 @jparise jparise committed Oct 15, 2011
Showing with 5 additions and 5 deletions.
  1. +2 −2 docs/guide.txt
  2. +3 −3 tests/composite.phpt
View
@@ -949,8 +949,8 @@ provides a compositing system that marks this task trivial.
Start by creating the individual log handlers::
- $console = Log::singleton('console', '', 'TEST');
- $file = Log::singleton('file', 'out.log', 'TEST');
+ $console = Log::factory('console', '', 'TEST');
+ $file = Log::factory('file', 'out.log', 'TEST');
Then, construct a composite handler and add the individual handlers as
children of the composite::
View
@@ -29,9 +29,9 @@ function testPriority($composite, $priority) {
/* Create three handlers with different priority masks. */
$conf = array('lineFormat' => '%2$s [%3$s] %4$s');
$children = array(
- Log::singleton('console', '', 'CONSOLE1', $conf),
- Log::singleton('console', '', 'CONSOLE2', $conf),
- Log::singleton('console', '', 'CONSOLE3', $conf)
+ Log::factory('console', '', 'CONSOLE1', $conf),
+ Log::factory('console', '', 'CONSOLE2', $conf),
+ Log::factory('console', '', 'CONSOLE3', $conf)
);
$children[0]->setMask(Log::MASK(PEAR_LOG_DEBUG));

0 comments on commit 5f33eb9

Please sign in to comment.