All notable changes to laravel-logweaver
will be documented in this file.
Full Changelog: https://github.com/halilcosdu/laravel-logweaver/compare/v1.0.5...v1.0.6
Full Changelog: https://github.com/halilcosdu/laravel-logweaver/compare/v1.0.4...v1.0.5
- Bump dependabot/fetch-metadata from 2.0.0 to 2.1.0 by @dependabot in #9
Full Changelog: https://github.com/halilcosdu/laravel-logweaver/compare/v1.0.3...v1.0.4
Release Notes for v1.0.3:
In this release, a new function download
has been added to the LogWeaver
class. This function allows you to download a log file from the storage disk.
Here's a brief overview of the new function:
download(string $path, $name = null, array $headers = []): StreamedResponse
: This function takes in three parameters:$path
,$name
, and$headers
. The$path
parameter is the path of the file in the storage disk. The$name
parameter is an optional parameter that specifies the name of the downloaded file. The$headers
parameter is an optional array of headers to be included in the response. The function returns aStreamedResponse
, which represents the response of the file download.
This new function enhances the functionality of the LogWeaver
class by providing an easy way to download log files.
Release Notes:
- Updated the test case 'should throw exception if parameters are invalid' in
tests/LogWeaverTest.php
. - The test now checks if an exception is thrown when invalid parameters are passed to the
LogWeaver
class. - This ensures the robustness of the
LogWeaver
class by validating its error handling capabilities.
This release includes updates to the test suite of the LogWeaver
class in the Laravel LogWeaver project. The tests have been rewritten using the Pest PHP testing framework, which provides a more expressive and streamlined syntax compared to traditional PHPUnit tests.
The changes include tests for the following functionalities of the LogWeaver
class:
- Instantiation of the
LogWeaver
class - Setting the description
- Setting the log resource
- Setting the content
- Setting the level
- Setting the disk
- Setting the directory
Each of these functionalities is tested in isolation to ensure that they work as expected. The tests are designed to be run using the vendor/bin/pest
command in the terminal.
This release is a part of ongoing efforts to improve the quality and reliability of the Laravel LogWeaver project by ensuring that all major functionalities are covered by automated tests.
This is the first major release of the Laravel LogWeaver package. This package provides a simple and flexible way to log events in your Laravel application, with support for multiple storage disks.
- Fluent interface for creating logs.
- Support for different log levels: info, warning, error, and critical.
- Ability to specify the resource of the log: system or event.
- Customizable storage disk and directory.
- Validation of log parameters.
- Conversion of log to array or JSON.
- Asynchronous logging with optional waiting for the log to be written to the disk.
Logging a user login event:
$log = LogWeaver::description('User logged in')
->logResource('event')
->content(['user_id' => 1, 'email' => '[email protected]'])
->level('info')
->toArray();
Logging a system error:
$log = LogWeaver::description('System error occurred')
->logResource('system')
->content(['error' => 'Database connection failed'])
->level('error')
->toArray();
Logging a critical event:
$log = LogWeaver::description('Payment gateway down')
->logResource('event')
->content(['gateway' => 'Stripe', 'status' => 'down'])
->level('critical')
->toArray();
Logging a warning:
$log = LogWeaver::description('Disk space running low')
->logResource('system')
->content(['disk_space' => '10% remaining'])
->level('warning')
->toArray();
Logging an event with custom disk and directory:
$log = LogWeaver::description('User registered')
->logResource('event')
->content(['user_id' => 2, 'email' => '[email protected]'])
->level('info')
->disk('local')
->directory('custom_logs')
->toArray();
You can install the package via composer:
composer require halilcosdu/laravel-logweaver
You can publish the config file with:
php artisan vendor:publish --tag="logweaver-config"
You can run the tests with:
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.