Posted in

Laravel 日志文件在 PhpStorm 中的支持 | PhpStorm 博客_AI阅读总结 — 包阅AI

包阅导读总结

1. 关键词:PhpStorm、Laravel、Log Files、Improvement、Settings

2. 总结:本文介绍了 PhpStorm 中对 Laravel 日志文件支持的新特性,包括格式优化、性能提升、远程服务器访问和可自定义设置,新支持令人印象深刻,用户可免费试用或更新体验。

3. 主要内容:

– PhpStorm 对 Laravel 日志文件支持的新特性

– 改进的日志文件格式

– 颜色编码行、突出显示错误、样式化可点击链接

– 不影响性能,新渲染器仅突出显示可见代码

– 终端窗口中的日志文件滚动输出也有相同样式

– 远程服务器上的日志文件

– 配置 SSH 连接后可浏览生产日志文件

– 日志文件的设置

– 可配置日志文件样式,包括热图、链接突出显示、模式、过滤器和格式

– 可创建自定义模式

– 邀请用户试用或更新 PhpStorm 体验新特性

思维导图:

文章地址:https://blog.jetbrains.com/phpstorm/2024/08/laravel-log-files-support-in-phpstorm/

文章来源:blog.jetbrains.com

作者:Brent Roose

发布时间:2024/8/12 14:23

语言:英文

总字数:608字

预计阅读时间:3分钟

评分:87分

标签:PhpStorm,Laravel,日志文件,开发工具,PHP


以下为原文内容

本内容来源于用户推荐转载,旨在分享知识与观点,如有侵权请联系删除 联系邮箱 media@ilingban.com

Tutorials

Laravel Log Files Support in PhpStorm

Today I want to look at a new feature in PhpStorm, one that I think many Laravel developers will find very interesting. Now, to be clear, I’m a Developer Advocate at JetBrains, so you might think it’s obvious I’m excited about PhpStorm. Well, I wouldn’t be writing this post if I weren’t genuinely thrilled about it myself. First and foremost, I’m a PHP and Laravel developer, and I write code daily. So yes, I can say from experience: I’m really excited about this one!

So, let’s take a look at how the latest version of PhpStorm has improved logger support!

VIDEO

Improved log files

Until recently, log files in PhpStorm have been pretty… boring. They are huge blobs of text – that’s it:

Now, I don’t know about you, but scrolling through those huge blobs becomes annoying pretty quickly – especially when you’re trying to debug production issues, which is probably the most common use case for reading a log file.

To streamline the experience of working with logs, the latest version of PhpStorm presents log files in a format that’s much easier to understand at a glance. They will now look something like this:

You can see how the lines are color-coded, errors are highlighted in the scroll bar, and links are styled and clickable. On top of that, bigger log files no longer affect PhpStorm’s performance. A special new renderer for log files allows the IDE to highlight only the code that is visible at any given time, which drastically reduces the amount of memory and CPU needed. Naturally, when you scroll, any new lines that appear will be styled properly as well.

Speaking of scrolling, another use case for log files is to tail them in a terminal window. We’ve added the same styling on that output as well, which means that you can keep your log file open and any new lines will be automatically styled correctly:

Log files on remote servers

Another common use case is browsing production log files via SSH. Let’s take a look at how that works in PhpStorm.

First you need to configure an SSH connection, which you can do by going to Settings | Tools | SSH Configurations.

Next, with the SSH configuration in place, you can start a new SSH session. Go to Tools | Deployment | Browse Remote Host and choose your newly created SSH configuration.

PhpStorm will open a new tool window for browsing the remote server. You can navigate to the log file, open it, and…

It looks just the same!

Pretty neat, right?

Finally, let’s talk about settings. You can go to Settings | Editor | Log Highlighting to configure how log files should be styled. You can enable or disable the heatmap (the colored scroll bar), choose whether links are highlighted, patterns, filters, and configure log formats (we’ve got support for Laravel, Symfony, WordPress, and more).

The section that’s probably most interesting is the patterns table, where you can change the styling of highlighted log entries. For example, I don’t like errors being bold, so I can change the error pattern accordingly:

On top of that, you can create your own patterns if you want to, which is pretty powerful if you want to create your own log highlighting rules, or if you’re reading a log file whose format isn’t supported out of the box.

In closing

The new support for log files is quite impressive if you ask me. Introduced in PhpStorm 2024.2, you can experience it now by starting a 30-day free trial or simply updating your IDE if you’re already a PhpStorm user.

Subscribe to PhpStorm Blog updates