You are here

public function TestLogger::__call in Lockr 7.3

File

vendor/psr/log/Psr/Log/Test/TestLogger.php, line 129

Class

TestLogger
Used for testing purposes.

Namespace

Psr\Log\Test

Code

public function __call($method, $args) {
  if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
    $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
    $level = strtolower($matches[2]);
    if (method_exists($this, $genericMethod)) {
      $args[] = $level;
      return call_user_func_array([
        $this,
        $genericMethod,
      ], $args);
    }
  }
  throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()');
}