Skip to content

[Monolog] List available built-in formatters #17742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions logging/formatter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,17 @@ configure your handler to use it:
->formatter('monolog.formatter.json')
;
};

Many built-in formatters are available in Monolog. A lot of them are declared as services
and can be used in the ``formatter`` option:

* ``monolog.formatter.chrome_php``: formats a record according to the ChromePHP array format
* ``monolog.formatter.gelf_message``: serializes a format to GELF format
* ``monolog.formatter.html``: formats a record into an HTML table
* ``monolog.formatter.json``: serializes a record into a JSON object
* ``monolog.formatter.line``: formats a record into a one-line string
* ``monolog.formatter.loggly``: formats a record information into JSON in a format compatible with Loggly
* ``monolog.formatter.logstash``: serializes a record to Logstash Event Format
* ``monolog.formatter.normalizer``: normalizes a record to remove objects/resources so it's easier to dump to various targets
* ``monolog.formatter.scalar``: formats a record into an associative array of scalar (+ null) values (objects and arrays will be JSON encoded)
* ``monolog.formatter.wildfire``: serializes a record according to Wildfire's header requirements