Handler sending logs to browser's javascript console with no browser extension required

CloneableInstantiable
ExtendsMonolog\Handler\AbstractProcessingHandler
Monolog\Handler\AbstractHandler
Monolog\Handler\Handler
ImplementsMonolog\Handler\FormattableHandlerInterface
Monolog\Handler\HandlerInterface
Monolog\Handler\ProcessableHandlerInterface
Monolog\ResettableInterface
Methods
public Monolog\Handler\AbstractHandler::__construct( $level = 100, bool $bubble = true)
 
    public Monolog\Handler\Handler::__destruct()
    public Monolog\Handler\Handler::__sleep()
    public close() : void
    public Monolog\Handler\AbstractHandler::getBubble() : bool
     

    Gets the bubbling behavior.

    • return bool true means that this handler allows bubbling. false means that bubbling is not permitted.
    public Monolog\Handler\AbstractProcessingHandler::getFormatter() : Monolog\Formatter\FormatterInterface
     

    {@inheritdoc}

    public Monolog\Handler\AbstractHandler::getLevel() : int
     

    Gets minimum logging level at which this handler will be triggered.

    • return int
    public Monolog\Handler\AbstractProcessingHandler::handle(array $record) : bool
     

    {@inheritdoc}

    public Monolog\Handler\Handler::handleBatch(array $records) : void
     

    {@inheritdoc}

    public Monolog\Handler\AbstractHandler::isHandling(array $record) : bool
     

    {@inheritdoc}

    public Monolog\Handler\AbstractProcessingHandler::popProcessor() : callable
     

    {@inheritdoc}

    public Monolog\Handler\AbstractProcessingHandler::pushProcessor(callable $callback) : Monolog\Handler\HandlerInterface
     

    {@inheritdoc}

    • suppress PhanTypeMismatchReturn
    public reset()
    public static resetStatic() : void
     

    Forget all logged records

    public static send() : void
     

    Convert records to javascript console commands and send it to the browser.

    This method is automatically called on PHP shutdown if output is HTML or Javascript.

    public Monolog\Handler\AbstractHandler::setBubble(bool $bubble) : self
     

    Sets the bubbling behavior.

    • return self
    public Monolog\Handler\AbstractProcessingHandler::setFormatter(Monolog\Formatter\FormatterInterface $formatter) : Monolog\Handler\HandlerInterface
     

    {@inheritdoc}

    • suppress PhanTypeMismatchReturn
    public Monolog\Handler\AbstractHandler::setLevel( $level) : self
     

    Sets minimum logging level at which this handler will be triggered.

    • return self
    Properties
    protected Monolog\Handler\AbstractHandler::$bubble
    protected Monolog\Handler\AbstractProcessingHandler::$formatter
     
    • var FormatterInterface
    protected static $initialized
    protected Monolog\Handler\AbstractHandler::$level
    protected Monolog\Handler\AbstractProcessingHandler::$processors
     
    • var callable[]
    protected static $records
    Methods
    protected getDefaultFormatter() : Monolog\Formatter\FormatterInterface
     

    {@inheritDoc}

    Formatted output may contain some formatting markers to be transferred to console.log using the %c format.

    Example of formatted string:

    You can do [[blue text]]{color: blue} or [[green background]]{background-color: green; color: white}
    
    protected static getResponseFormat() : string
     

    Checks the format of the response

    If Content-Type is set to application/javascript or text/javascript -> js
    If Content-Type is set to text/html, or is unset -> html
    If Content-Type is anything else -> unknown

    • return string One of 'js', 'html' or 'unknown'
    protected Monolog\Handler\AbstractProcessingHandler::processRecord(array $record) : array
     

    Processes a record.

    protected registerShutdownFunction() : void
     

    Wrapper for register_shutdown_function to allow overriding

    protected Monolog\Handler\AbstractProcessingHandler::resetProcessors() : void
    protected write(array $record) : void
     

    {@inheritDoc}

    protected static writeOutput(string $str) : void
     

    Wrapper for echo to allow overriding

    Methods
    private static call( $args) : string
    private static call_array(string $method, array $args) : string
    private static dump(string $title, array $dict) : array
    private static generateScript() : string
    private static handleCustomStyles(string $style, string $string) : string
    private static handleStyles(string $formatted) : array
    private static quote(string $arg) : string
    Properties
    protected static $initialized
    protected static $records
    Methods
    private static call( $args) : string
    private static call_array(string $method, array $args) : string
    private static dump(string $title, array $dict) : array
    private static generateScript() : string
    protected static getResponseFormat() : string
     

    Checks the format of the response

    If Content-Type is set to application/javascript or text/javascript -> js
    If Content-Type is set to text/html, or is unset -> html
    If Content-Type is anything else -> unknown

    • return string One of 'js', 'html' or 'unknown'
    private static handleCustomStyles(string $style, string $string) : string
    private static handleStyles(string $formatted) : array
    private static quote(string $arg) : string
    public static resetStatic() : void
     

    Forget all logged records

    public static send() : void
     

    Convert records to javascript console commands and send it to the browser.

    This method is automatically called on PHP shutdown if output is HTML or Javascript.

    protected static writeOutput(string $str) : void
     

    Wrapper for echo to allow overriding

    © 2020 Bruce Wells
    Search Namespaces \ Classes
    ConfigurationNumbers (0-9.) only