UserFrosting API

MixedFormatter extends LineFormatter

Monolog formatter for pretty-printing arrays and objects.

This class extends the basic Monolog LineFormatter class, and provides basically the same functionality but with one exception: if the second parameter of any logging method (debug, error, info, etc) is an array, it will print it as a nicely formatted, multi-line JSON object instead of all on a single line.

Tags
author

Alex Weissman (https://alexanderweissman.com)

Table of Contents

toJson() Return the JSON representation of a value. string
jsonEncodePretty() string

Methods

toJson()

Return the JSON representation of a value.

protected toJson( $data : mixed [, $ignoreErrors : bool = false ] ) : string
Parameters
$data : mixed
$ignoreErrors : bool = false
Tags
throws
RuntimeException

if encoding fails and errors are not ignored

Return values
string

jsonEncodePretty()

private jsonEncodePretty( $data : mixed ) : string
Parameters
$data : mixed
Return values
string

JSON encoded data or null on failure

Search results