private function parseMessage($message)
    {
        $parsedMessage = null;

        /**
         * According to PSR-3 we can accept string-like values (eg stuff we can parse easily into a string, such as obviously
         * strings and numbers, and objects that can be cast to strings).
         */
        switch (gettype($message)) {
            case 'boolean':
            case 'integer':
            case 'double':
            case 'string':
            case 'NULL':
                $parsedMessage = (string) $message;
                break;

            case 'object':
                if (method_exists($message, '__toString') !== false) {
                    $parsedMessage = (string) $message;
                    break;
                }
                // Otherwise, go on to default below

            default:
                throw new InvalidArgumentException('Message can only be a string, number or an object which can be cast to a string');
        }

        return $parsedMessage;
    }
private function parseMessage($message)
    {
        $parsedMessage = null;

        /**
         * According to PSR-3 we can accept string-like values (eg stuff we can parse easily into a string, such as obviously
         * strings and numbers, and objects that can be cast to strings).
         */
        switch (gettype($message)) {
            case 'boolean':
            case 'integer':
            case 'double':
            case 'string':
            case 'NULL':
                $parsedMessage = (string) $message;
                break;

            case 'object':
                if (method_exists($message, '__toString') !== false) {
                    $parsedMessage = (string) $message;
                    break;
                }
                // Otherwise, go on to default below

            default:
                throw new InvalidArgumentException('Message can only be a string, number or an object which can be cast to a string');
        }

        return $parsedMessage;
    }
private function parseMessage ( $ message ) { $ parsedMessage = null ; /**
         * According to PSR-3 we can accept string-like values (eg stuff we can parse easily into a string, such as obviously
         * strings and numbers, and objects that can be cast to strings).
         */ switch ( gettype ( $ message ) ) { case 'boolean' : case 'integer' : case 'double' : case 'string' : case 'NULL' : $ parsedMessage = ( string ) $ message ; break ; case 'object' : if ( method_exists ( $ message , '__toString' ) !== false ) { $ parsedMessage = ( string ) $ message ; break ; } // Otherwise, go on to default below default : throw new InvalidArgumentException ( 'Message can only be a string, number or an object which can be cast to a string' ) ; } return $ parsedMessage ; }
Parses the log message and returns as a useable string, or Psr\Log\InvalidArgumentException if non parseable.

We only recognise info/notice/debug/warning/alert/error/emergency/critical levels, anything else will
throw an InvalidArgumentException.

@param mixed $message

@return string

@throws InvalidArgumentException

@see: http://www.php-fig.org/psr/psr-3/#1-2-message
Parses the log message and returns as a useable string or Psr \ Log \ InvalidArgumentException if non parseable .