Esempio n. 1
0
 public function __construct()
 {
     // build the chain of responsibility
     $l = new DebugLogger(Logger::DEBUG);
     $e = new EmailLogger(Logger::NOTICE);
     $s = new StderrLogger(Logger::ERR);
     $l->setNext($e->setNext($s));
     $l->message("Entering function y.", Logger::DEBUG);
     // handled by DebugLogger
     $l->message("Step1 completed.", Logger::NOTICE);
     // handled by DebugLogger and EmailLogger
     $l->message("An error has occurred.", Logger::ERR);
     // handled by all three Loggers
 }