Home / Snippets / How to log with parameters in Laravel 8
How to log with parameters in Laravel 8 cover

How to log with parameters in Laravel 8

738

2 years ago

0 comments

In Laravel, you can log messages using the Log facade. There are 8 types of logs depending on the situation and below is the list of the available logs in Laravel.

All Type of Logs in Laravel
use Illuminate\Support\Facades\Log;

Log::emergency($message);
Log::alert($message);
Log::critical($message);
Log::error($message);
Log::warning($message);
Log::notice($message);
Log::info($message);
Log::debug($message);

Passing Parameters to Logs
To pass parameters when logging data you can pass an array as the 2nd parameter. You can pass any number of key-value pairs as necessary.
Log::alert('Some alert message mere', ['hello' => 'world']);
Log::info('Some info message mere', ['hello' => 'world']);
notion avatar

Ahmad Aziz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Post Tutorials

Learn trending tutorials for ReactJs, React Native, VueJS, NextJs, Laravel, Tailwind CSS, and Flutter development.
View Tutorials

Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that's right for your web projects
View Components

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this