src/php/Arbit/Periodic/Logger/Cli.php
public function log( $message, $severity = self::INFO )
    {
        if ( !isset( $this->mapping[$severity] ) )
        {
            throw new \RuntimeException( "Unknown severity: " . $severity );
        }

        switch ( $pipe = $this->mapping[$severity] )
        {
            case self::SILENCE:
                // Ignore this message
                return;

            case self::STDOUT:
                $stream = 'php://stdout';
                break;

            case self::STDERR:
                $stream = 'php://stderr';
                break;

            default:
                throw new \RuntimeException( "Unknown output pipe: " . $pipe );
        }

        // Generate and output error message
        $this->write( $stream, sprintf( "[%s]%s %s: %s\n",
            date( 'Y/m/d-H:i.s' ),
            ( $this->task ?
                ' (' . $this->task . (
                    $this->command ?
                        '::' . $this->command :
                        ''
                ) . ')' :
                ''
            ),
            $this->names[$severity],
            $message
        ) );
    }
public function log( $message, $severity = self::INFO )
    {
        if ( !isset( $this->mapping[$severity] ) )
        {
            throw new \RuntimeException( "Unknown severity: " . $severity );
        }

        switch ( $pipe = $this->mapping[$severity] )
        {
            case self::SILENCE:
                // Ignore this message
                return;

            case self::STDOUT:
                $stream = 'php://stdout';
                break;

            case self::STDERR:
                $stream = 'php://stderr';
                break;

            default:
                throw new \RuntimeException( "Unknown output pipe: " . $pipe );
        }

        // Generate and output error message
        $this->write( $stream, sprintf( "[%s]%s %s: %s\n",
            date( 'Y/m/d-H:i.s' ),
            ( $this->task ?
                ' (' . $this->task . (
                    $this->command ?
                        '::' . $this->command :
                        ''
                ) . ')' :
                ''
            ),
            $this->names[$severity],
            $message
        ) );
    }
Log message

Log a message, while the message must be convertable into a string.
Optionally a log message severity can be specified.

@param string $message
@param int $severity
@return void