Skip to content

Commit 1fa074e

Browse files
committed
remove const LOG_FILE
1 parent 0b6a678 commit 1fa074e

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/Jenner/Crontab/Daemon.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,14 @@
1515

1616
class 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'],

0 commit comments

Comments
 (0)