Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Log Manager Laravel Package

sinarajabpour1998/log-manager

Laravel log manager with UI components and migrations to store custom activity logs and system error logs in database tables. Define log types in config, use LogFacade to generate logs, and hook into Exception Handler to capture errors.

View on GitHub
Deep Wiki
Context7

Log Manager

This package provides log manager for laravel apps.

Installation

Using Composer :

composer require sinarajabpour1998/log-manager

packagist : log-manager

Usage

  • Publish blade files
php artisan vendor:publish --tag=log-manager

** Please note if you already published the vendor, for updates you can run the following command :

php artisan vendor:publish --tag=log-manager --force
  • Run migration command :
php artisan migrate
  • Add the following tag in your sidebar layout :
<x-log-menu></x-log-menu>

or shorten tag :

<x-log-menu />

Save custom logs

  • First define some log types in log-manager config :

Types structure: "type" => "type_name"

[
"log_types" => [
        "login" => "ورود به سایت",
        "registration" => "ثبت نام در سایت"
    ]
];
  • Add the following code anywhere you want (be careful about namespace)
use Sinarajabpour1998\LogManager\Facades\LogFacade;

LogFacade::generateLog("login");

Done ! now all the logs will be saved in the logs table

Save system error logs

Edit the following file :

app\Exceptions\Handler.php

Your register method in Exception handler must be like this :

    use Sinarajabpour1998\LogManager\Facades\LogFacade;
    /**
     * Register the exception handling callbacks for the application.
     *
     * @return void
     */
    public function register()
    {
        $this->reportable(function (Throwable $e) {
            // Added for log-manager
            if ($this->shouldReport($e)){
                LogFacade::generateErrorLog($e);
            }
        });
    }

Done ! now all the system error logs will be saved in the error_logs table

Config options

You can set custom permissions for each section of this package. make sure that you already specified permissions in a seeder.

Also you need log_types before get started with custom logs.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver