Felipe Francisco
Felipe Francisco

Reputation: 1063

Laravel 5.1 - How can I log requests made to an endpoint?

An external app make requests to my endpoint "/charge-handler/{id}". The request has some data about a debt payment status.

How can I log requests made to an endpoint?

What are the best practices for loging this kind of info?

I tried to find a lib for logging this, but I can't find something suitable :(

I'm using Laravel 5.1.26

Upvotes: 1

Views: 1182

Answers (2)

Can Celik
Can Celik

Reputation: 2087

I think best option is to use Laravel Events.

You need to both define an event and listener.

Checkout this documentation https://laravel.com/docs/5.2/events

Upvotes: 1

jakub_jo
jakub_jo

Reputation: 1634

You could use the Log facade:

Log::info($message);

See: https://laravel.com/docs/5.1/errors#logging

Upvotes: 1

Related Questions