protected function replaceContext($message, string $key, $context)
    {
        $strContext = '';
        if (is_object($context)) {
            if (method_exists($context, '__toString')) {
                $strContext = call_user_func([$context, '__toString']);
            } else {
                $strContext = var_export($context, true);
            }
        } else {
            $strContext = $context;
        }

        return str_replace('{'.$key.'}', $strContext, $message);
    }
protected function replaceContext($message, string $key, $context)
    {
        $strContext = '';
        if (is_object($context)) {
            if (method_exists($context, '__toString')) {
                $strContext = call_user_func([$context, '__toString']);
            } else {
                $strContext = var_export($context, true);
            }
        } else {
            $strContext = $context;
        }

        return str_replace('{'.$key.'}', $strContext, $message);
    }
protected function replaceContext ( $ message , string $ key , $ context ) { $ strContext = '' ; if ( is_object ( $ context ) ) { if ( method_exists ( $ context , '__toString' ) ) { $ strContext = call_user_func ( [ $ context , '__toString' ] ) ; } else { $ strContext = var_export ( $ context , true ) ; } } else { $ strContext = $ context ; } return str_replace ( '{' . $ key . '}' , $ strContext , $ message ) ; }
Replace context pattern in the message with related context.

@param string $message Log message
@param string $key     Context pattern to be replaced
@param mixed  $context Related context to replace $key

@return string $message with pattern '{$key}' replaced by $context
Replace context pattern in the message with related context .