Commit c3afdce8 authored by pengfei's avatar pengfei

add job log

parent 67e0fc84
...@@ -30,15 +30,22 @@ class JobLog ...@@ -30,15 +30,22 @@ class JobLog
public function __call($name, $arguments) public function __call($name, $arguments)
{ {
$this->log = !empty($arguments[1]) ? $arguments[1] : ''; $this->setLog($arguments);
if (in_array($name, get_class_methods(FileLog::class))) { if (in_array($name, get_class_methods(FileLog::class))) {
call_user_func_array([FileLog::class, $name], $arguments); call_user_func_array([FileLog::class, $name], $arguments);
} }
return $this; return $this;
} }
private function setLog($arguments)
{
if (!empty($arguments[0]) && !empty($arguments[1])) {
$this->log = date('Y-m-d H:i:s') . ";$arguments[0]:$arguments[1]" . PHP_EOL;
}
}
public function output() public function output()
{ {
echo date('Y-m-d H:i:s') . ';' . $this->log . PHP_EOL; echo $this->log . PHP_EOL;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment