src/RocknRoot/StrayFw/Logger.php
public function log($level, $message, array $context = array())
    {
        if (! is_string($message)) {
            throw new LoggerInvalidArgumentException(sprintf(
                'Argument 2 passed to %s must be a string!',
                __METHOD__
            ));
        }

        static $levels = array(
            LogLevel::EMERGENCY,
            LogLevel::ALERT,
            LogLevel::CRITICAL,
            LogLevel::ERROR,
            LogLevel::WARNING,
            LogLevel::NOTICE,
            LogLevel::INFO,
            LogLevel::DEBUG
        );
        if (in_array($level, $levels) === false) {
            throw new LoggerInvalidArgumentException('unknown level "' . $level . '"');
        }
        $message = $message;
        foreach ($context as $key => $value) {
            $message = str_replace('{' . $key . '}', $value, $message);
        }
        error_log('[' . $level . '] ' . $message);
        if (defined('STRAY_IS_CLI') === true && STRAY_IS_CLI === true) {
            echo '[' . $level . '] ' . $message . PHP_EOL;
        }
    }
public function log($level, $message, array $context = array())
    {
        if (! is_string($message)) {
            throw new LoggerInvalidArgumentException(sprintf(
                'Argument 2 passed to %s must be a string!',
                __METHOD__
            ));
        }

        static $levels = array(
            LogLevel::EMERGENCY,
            LogLevel::ALERT,
            LogLevel::CRITICAL,
            LogLevel::ERROR,
            LogLevel::WARNING,
            LogLevel::NOTICE,
            LogLevel::INFO,
            LogLevel::DEBUG
        );
        if (in_array($level, $levels) === false) {
            throw new LoggerInvalidArgumentException('unknown level "' . $level . '"');
        }
        $message = $message;
        foreach ($context as $key => $value) {
            $message = str_replace('{' . $key . '}', $value, $message);
        }
        error_log('[' . $level . '] ' . $message);
        if (defined('STRAY_IS_CLI') === true && STRAY_IS_CLI === true) {
            echo '[' . $level . '] ' . $message . PHP_EOL;
        }
    }
Logs with an arbitrary level.

@throws LoggerInvalidArgumentException if level is unknown
@param  mixed                          $level
@param  string                         $message
@param  array                          $context