将日志打印到终端运行的工匠服务 [英] Print log to terminal running artisan serve
本文介绍了将日志打印到终端运行的工匠服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试调试应用程序,并且使用 Log
门面的日志语句很少.现在,我使用 artisan serve
运行该应用程序,它将日志消息写入日志文件,并获取我运行的实时日志消息.
I am trying to debug my application and I had few log statements using Log
facade. For now, I run the application using artisan serve
and it will write the log message to the log file and to get a real time log message I run.
tail -f laravel.log
有什么方法可以将日志消息直接打印到运行 php artisan serve
的同一控制台/终端上吗?
Is there any way I can directly print the log message to the same console/terminal that is running php artisan serve
?
推荐答案
您可以使用以下方法执行此操作.可以在任何地方使用..
You can do this using following. This works anywhere..
$output = new Symfony\Component\Console\Output\ConsoleOutput();
$output->writeln("<info>Error message</info>");
这将在运行 php artisan serve
这篇关于将日志打印到终端运行的工匠服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文