File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change 1515
1616class Daemon extends AbstractDaemon
1717{
18- /**
19- * default daemon log file
20- */
21- const LOG_FILE = '/var/log/php_crontab.log ' ;
22-
2318 /**
2419 * @var array cron config
2520 * format[
2621 * task_name => [
2722 * 'name'=>'task_name',
2823 * 'cmd'=>'shell command',
29- * 'out'=>'output',
30- * 'err'=>'errout'
24+ * 'out'=>'output file or instance of LoggerInterface ',
25+ * 'err'=>'errout file or instance of LoggerInterface '
3126 * 'time'=>'* * * * *',
3227 * 'user'=>'process user',
3328 * 'group'=>'process group',
@@ -123,8 +118,17 @@ protected function createCrontab()
123118 $ tasks = $ this ->formatTasks ();
124119 $ missions = array ();
125120 foreach ($ tasks as $ task ) {
126- $ out = MissionLoggerFactory::create ($ task ['out ' ]);
127- $ err = MissionLoggerFactory::create ($ task ['err ' ]);
121+ if ($ task ['out ' ] instanceof LoggerInterface) {
122+ $ out = $ task ['out ' ];
123+ }else {
124+ $ out = MissionLoggerFactory::create ($ task ['out ' ]);
125+ }
126+ if ($ task ['err ' ] instanceof LoggerInterface) {
127+ $ err = $ task ['err ' ];
128+ }else {
129+ $ err = MissionLoggerFactory::create ($ task ['err ' ]);
130+ }
131+
128132 $ mission = new Mission (
129133 $ task ['name ' ],
130134 $ task ['cmd ' ],
You can’t perform that action at this time.
0 commit comments