michael-orenda / logging
Unified hybrid logging package (activity, security, and error logs) for Laravel applications.
Installs: 2
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/michael-orenda/logging
Requires
- php: >=8.2
- illuminate/database: ^12.0
- illuminate/support: ^12.0
README
Overview
michael-orenda/logging is a robust logging package for Laravel applications. It supports:
- Activity Logs
- Security Logs
- Error Logs
- Facade API
- Helper functions
- Loggable Trait for automatic logging
- Pruning & archiving logs
- Event dispatching for log-related events
Features
- Unified logging API for Activity, Security, and Error Logs.
- Automatic logging of model CRUD actions with
Loggabletrait. - Prune old logs with the
logging:prunecommand. - Provides endpoints for admin access to logs.
Installation
Install using Composer:
composer require michael-orenda/logging
Publish the configuration:
php artisan vendor:publish --tag=logging-config
Run migrations:
php artisan migrate
Configuration
The configuration is located in config/logging.php. You can set log retention policies, default severities, and other parameters.
Usage
You can log events using the facade:
Logger::activity('user_logged_in', ['user_id' => $user->id]); Logger::security('unauthorized_access', ['ip' => $ip]); Logger::error('payment_failed', ['order_id' => $orderId]);
API Endpoints
/orenda/logs/activity/orenda/logs/security/orenda/logs/error
These endpoints return the logs in JSON format and support pagination.
Loggable Trait
To log model CRUD events, add the Loggable trait:
use Loggable; class User extends Model { use Loggable; }
License
MIT License