Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

JSON logger context

Hi all

I'm wokring with the formatter Phalcon\Logger\Formatter\Json and this works for the standard input for e.g error $logger->error("Message");


I would like to extend this, to e.g. {"type":"ERROR","message":"Message","timestamp":1448102495,"userid":5}, but i can't figure out howto. I believe that at solution should include the $context array in the logger. So it would be something like this


Any suggestions to make this?

Thanks in advance

BR Mads

edited Nov '15

you can just do something like this:


I using writing it like this for json body from request and post data.