How to save errors to file

Hello, how to save caught error to file log.

catch (\Exception $e) { $this->flash->error($e->getMessage()); }

This is shown for users in UI, but I want to save this to log file.

Hi Andrew you can use the log service

catch (\Exception $e) {

or even you can create your ouw flash service and auto log all messages

Can a logger handle details like "$arguments" ?

sure you can use placeholders like this

$this->log->error('Huoston we have a problem. Detail: {detail}. Arguments: {args}',
        'detail' => $e->getMessage(),
        'args' => print_r($mixedVar, true)

Good luck