src/Logger.php
public function log($level, $message, array $context = [])
    {
        if ($this->convertLevel($level) > $this->level) {
            return;
        }

        # Handle objects implementing __toString
        $message = (string)$message;

        # Handle any placeholders in the $context array
        foreach ($context as $key => $val) {
            $placeholder = "{" . $key . "}";

            # If this context key is used as a placeholder, then replace it, and remove it from the $context array
            if (strpos($message, $placeholder) !== false) {
                $val = (string)$val;
                $message = str_replace($placeholder, $val, $message);
                unset($context[$key]);
            }
        }

        # Send the message to the climate instance
        $this->climate->{$level}($message);

        # Append any context information not used as placeholders
        $this->outputRecursiveContext($level, $context, 1);
    }
public function log($level, $message, array $context = [])
    {
        if ($this->convertLevel($level) > $this->level) {
            return;
        }

        # Handle objects implementing __toString
        $message = (string)$message;

        # Handle any placeholders in the $context array
        foreach ($context as $key => $val) {
            $placeholder = "{" . $key . "}";

            # If this context key is used as a placeholder, then replace it, and remove it from the $context array
            if (strpos($message, $placeholder) !== false) {
                $val = (string)$val;
                $message = str_replace($placeholder, $val, $message);
                unset($context[$key]);
            }
        }

        # Send the message to the climate instance
        $this->climate->{$level}($message);

        # Append any context information not used as placeholders
        $this->outputRecursiveContext($level, $context, 1);
    }
public function log ( $ level , $ message , array $ context = [ ] ) { if ( $ this -> convertLevel ( $ level ) > $ this -> level ) { return ; } # Handle objects implementing __toString $ message = ( string ) $ message ; # Handle any placeholders in the $context array foreach ( $ context as $ key => $ val ) { $ placeholder = "{" . $ key . "}" ; # If this context key is used as a placeholder, then replace it, and remove it from the $context array if ( strpos ( $ message , $ placeholder ) !== false ) { $ val = ( string ) $ val ; $ message = str_replace ( $ placeholder , $ val , $ message ) ; unset ( $ context [ $ key ] ) ; } } # Send the message to the climate instance $ this -> climate -> { $ level } ( $ message ) ; # Append any context information not used as placeholders $ this -> outputRecursiveContext ( $ level , $ context , 1 ) ; }
Log messages to a CLImate instance.

@param string $level One of the LogLevel constants
@param string|object $message If an object is passed it must implement __toString()
@param array $context Placeholders to be substituted in the message

@return void
Log messages to a CLImate instance .