Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I log from a Laravel blade template?

I want to log from within a Laravel blade template. Can I log something using the Laravel logger, or a simple syslog(1, 'my message') would even be better.

All tips are welcome!

like image 486
kramer65 Avatar asked Oct 02 '18 13:10

kramer65


2 Answers

You can use logger in blade

{{ logger('Test') }}
like image 138
Volkan Yılmaz Avatar answered Sep 22 '22 17:09

Volkan Yılmaz


You can use laravel helper function

for store information on log use info function

{{ info("print log in blade")}}

for debug level message on log use logger function Don't add semi colon in the logger function.

 //{{ logger('Debug message'); }}

   {{ logger('Debug message') }}
like image 21
Jignesh Joisar Avatar answered Sep 23 '22 17:09

Jignesh Joisar