I'm trying to keep a Log of all the activities that a user performs (from clicking on Login button to all the CRUD operation) in my application.
Eg - When the user clicks on a 'Create Item' button I wish to log info(when it was created, what was created, by whom etc.) in a separate file under /storage/logs/my_own_file.log.
I have been able to do that using the Log::info and Log:useDailyFiles() function.
Now whatever information I wish to display from the Log files, should come on some view(assume a random view page). I have thought of extracting the Log files info in JSON format so that I can pass that variable in the view.
I don't know how to go about it as of now.
This the Log file when I click on the Edit button
This is the Log file when I click the Submit button
For the time being assume, I want the timestamps(individually) and the id as JSON format
答案 0 :(得分:0)
您应该考虑将活动日志存储在数据库而不是文件中,您不会被解析这种方式。我在我的几个项目中使用这个包:
https://github.com/spatie/laravel-activitylog
这使您可以更灵活地保存所保存的内容以及可以访问的应用程序堆栈的深度。