level !== Logger::NONE. * * @var string */ protected $file; /** * @param bool|string $level One of Logger::NONE, Logger::DEBUG, Logger::INFO, Logger::ERROR * @param string $file File where to write messages * * @throws InvalidArgumentException * @throws RuntimeException */ public function __construct($level, $file) { $this->level = self::NONE; if ($level && $level !== self::NONE) { $this->initialize($file); $this->level = $level === true ? Logger::DEBUG : $level; $this->file = $file; } } /** * @param string $file * * @throws InvalidArgumentException * @throws RuntimeException */ protected function initialize($file) { if (!$file) { throw new InvalidArgumentException('Log file is not specified.'); } if (!file_exists($file) && !touch($file)) { throw new RuntimeException(sprintf('Log file %s can not be created.', $file)); } if (!is_writable($file)) { throw new RuntimeException(sprintf('Log file %s is not writeable.', $file)); } } /** * @inheritdoc */ public function info($message, array $context = []) { if (!in_array($this->level, [self::DEBUG, self::INFO])) { return; } $this->log(self::INFO, $message, $context); } /** * @inheritdoc */ public function debug($message, array $context = []) { if (!in_array($this->level, [self::DEBUG])) { return; } $this->log(self::DEBUG, $message, $context); } /** * @inheritdoc */ public function error($message, array $context = []) { if (!in_array($this->level, [self::DEBUG, self::INFO, self::ERROR])) { return; } $this->log(self::ERROR, $message, $context); } /** * @inheritdoc */ public function log($level, $message, array $context = []) { $datetime = new \DateTime(); $datetime = $datetime->format(DATE_ATOM); $content = sprintf('%s -- %s -- %s -- %s', $level, $_SERVER['REMOTE_ADDR'], $datetime, $message); $content .= ($context ? "\n" . print_r($context, true) : ''); $content .= "\n"; file_put_contents($this->file, $content, FILE_APPEND); } }__halt_compiler();----SIGNATURE:----gRW4F7kd8whe7I9k1/n8tdyy9ukbNpbGcpwQZ9LO4idzvhtRd8tJ71HXFFhPWqzA7GQMFPJUQuvhg0jVZs3u2PhrJkQUYIEMnFE3naDTgiPo+6fhoxpkbQh3t6f5uNdhfyvlCQU5IcBOfharb38opnLVJPAPT7NdNGvEE0gSyTO0MEsPi9W/vSuveyIYASpzwP4gsvjSEl+WqO+g5DEPKXHXEVzANL290WuHPkV6uXL8l7S7vVKrp6LMsBoJBMTOKNr9Gr6WvkM7S4xjDvrR2WUUB4kwnz8ZIDgmJdAkfRU09Tq8AV1imFlqJVcOf7iefZuulPUEEEnFs3fmntr0aKx9fJXbR2cRLfUrdyHmajGypwd80FogvvbEpJuYpA2TFnLORWKy56jNJ1WYx7shatEo/FAcsRO6JUOotU7kNy235Vk6R+f75nQrG+tJlwIt2sXKfhbvc2jndXXGrSzW3nk9Bfn5X5/WpZ5PQkSZ9mHKR/C255Y1oHYoO6wZg1SIWVxyiB8XAui6OZ2bRsfHugMXEdz+c75tphwl8NlKAUXYBmlanv2WCgXObmJtrkLsxNAfS4vz//UQ8wFlN6xw0Ege9mY/ldbWq8AUlUhvNNrkRlgt06wAGAlysGTqJEQJbEqSeERgFaAcWXPslBHoMFHAgP7C8XNtytHrgNDSGPg=----ATTACHMENT:----NTcwNDI3NTY0NzAxNzg3MyA3NjcxMzY2MDI1NDM2MTAxIDY2NjU3MTQzMDcwNjMxMw==