File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33use Clockwork \DataSource \DataSource ;
44use Clockwork \Request \Log ;
55use Clockwork \Request \Request ;
6- use Clockwork \Support \Monolog \Handler \ClockworkHandler ;
7-
6+ use Clockwork \Support \Monolog \Monolog2 \ClockworkHandler as Monolog2ClockworkHandler ;
7+ use Clockwork \ Support \ Monolog \ Monolog \ ClockworkHandler ;
88use Monolog \Logger as Monolog ;
99
1010// Data source for Monolog, provides application log
@@ -18,7 +18,21 @@ public function __construct(Monolog $monolog)
1818 {
1919 $ this ->log = new Log ;
2020
21- $ monolog ->pushHandler (new ClockworkHandler ($ this ->log ));
21+ $ handler =null ;
22+ switch (\Monolog \Logger::API ) {
23+ case 1 :
24+ $ handler =new ClockworkHandler ($ this ->log );
25+ break ;
26+ case 2 :
27+ $ handler =new Monolog2ClockworkHandler ($ this ->log );
28+ break ;
29+ default :
30+ // By default use the latest implementation of clockwork handler
31+ $ handler =new Monolog2ClockworkHandler ($ this ->log );
32+ break ;
33+ }
34+
35+ $ monolog ->pushHandler ($ handler );
2236 }
2337
2438 // Adds log entries to the request
You can’t perform that action at this time.
0 commit comments