Log Viewer v3 is out
Tags: laravel, php, package, news
Published: 2023-08-28 11:46:43

[Log Viewer v3](https://github.com/opcodesio/log-viewer) brings several quality of life features that I'm sure you will enjoy - different log format support, and email previews.

## Support for multiple log formats

Log Viewer can now view not just Laravel logs, but also Apache, Nginx, Redis, Postgres, Supervisor, and more. [Here](https://log-viewer.opcodes.io/docs/3.x/log-types/default?ref=dev.to) you can see the types of logs that are now supported by Log Viewer out of the box.

Showing these logs in the new Log Viewer is as easy as adding the paths to your logs in the `config/log-viewer.php` configuration, like so:

```php
    /*
    |---------------------------------------------------------
    | Include file patterns
    |---------------------------------------------------------
    |
    */

    'include_files' => [
        '*.log',
        '**/*.log',

        // You can include paths to other log types as well, such as apache, nginx, and more.
        '/var/log/httpd/*',
        '/var/log/nginx/*',

        // For example, logs can be found on MacOS Apple Silicon machines
        '/opt/homebrew/var/log/nginx/*',
        '/opt/homebrew/var/log/httpd/*',
        '/opt/homebrew/var/log/php-fpm.log',
        '/opt/homebrew/var/log/postgres*log',
        '/opt/homebrew/var/log/redis*log',
        '/opt/homebrew/var/log/supervisor*log',

        // '/absolute/paths/supported',
    ],
```

If you don't see a particular log format, don't worry - you can now [define custom log formats](https://log-viewer.opcodes.io/docs/3.x/log-types/custom?ref=dev.to) which will allow you to browse these custom logs within the Log Viewer UI that you love. Defining custom logs also works for overriding the existing, built-in log formats. If, for example, your Laravel or HTTP logs are somehow different from factory defaults, you can extend the parser classes to include the custom modifications you've made. You can read all about extending log formats [here](https://log-viewer.opcodes.io/docs/3.x/log-types/default?ref=dev.to#extending-a-pre-built-log-type).

### Log type switcher

Supporting multiple types of logs means there a lot more... logs... To help find exactly what you're looking for, or to focus your search on particular log types, we have added a log type selector. The selector will show up as soon as Log Viewer finds more than one type of log.

![Log Viewer log type switcher in action](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0zn53v0yh003lampnlr4.png)

## Email previews

How often do you use the `log` mail driver? I know I don't, simply because it's very difficult to read these raw emails with headers and MIME parts, much less see how they actually look. I've always opted in for other solutions like Mailtrap, Helo, or just sending real emails.

Well, all the other tools require additional setup, separate apps, or can be plain dangerous in test environments (ever sent a test email to a real person by mistake?)

The `log` mail driver is the simplest, and safest approach to sending emails locally. It becomes even more useful with Log Viewer v3, which brings email previews directly within the Log Viewer:

![Log Viewer email previews in action](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8dxhrrc639dlqmdy2lxh.png)

All you need to make this work is to set this in your `.env`:

```env
MAIL_MAILER=log
```

The emails you send will instead be logged to your Laravel log, and they will then be viewable within the Log Viewer. Nifty little feature, don't you think? :)

## Upgrading

Log Viewer v3 is an easy upgrade without any breaking changes for most users. You can learn how to [upgrade from v2 to v3 here](https://log-viewer.opcodes.io/docs/3.x/upgrade?ref=dev.to). The documentation has been updated for Log Viewer v3.

## Questions / Feedback

If you have any questions, issues, bugs to report - please send them directly to the project's GitHub page - [issues](https://github.com/opcodesio/log-viewer/issues?ref=dev.to) or [discussions](https://github.com/opcodesio/log-viewer/discussions?ref=dev.to).

## Support

If you enjoy using this **free**, open-source project, there's several ways you can give back:

- Submit a PR - fix a bug, add a new feature, refactor code. All PRs are welcome.
- Add support for additional log formats - there's tons of different log formats in the world, and the more we can support in the Log Viewer - the better. Submit a PR with a new format support.
- [Buy me a coffee!](https://www.buymeacoffee.com/arunas?ref=dev.to) ☕️ I'm an avid coffee drinker, which helps me work through the weekends after my full-time job to provide you with the Log Viewer for free :)