travelnoord / laravel-ecs-logging
A Laravel package for performing logging in an Elastic-compatible format.
Requires
- php: ^8.3
- ext-json: *
- hamidrezaniazi/pecs: ^2.0
- laravel/framework: ^11.15|^12.2
- monolog/monolog: ^3.0
- psr/http-message: ^2.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: 1.21.0
- orchestra/pest-plugin-testbench: ^3.2
- orchestra/testbench: ^v9.12.0|v10.1.0
- orchestra/testbench-core: ^v9.12.0|v10.1.0
- pestphp/pest: ^3.7
- pestphp/pest-plugin-drift: ^3.0
- shipmonk/composer-dependency-analyser: ^1.8
README
This package implements Elastic ECS logging.
Installation
To install this package, define the repository in your composer.json file, for example:
composer require travelnoord/laravel-ecs-logging
Configuration
TBD
Only filter out the log message
TBD
Usage
Filter Secrets
To filter out secrets or other private information call the log filter:
\Ecs::secret('my-secret-password');
or
\Travelnoord\Logging\Facades\Ecs::secret('my-secret-password');
You can also pass an array with credentials:
\Ecs::filter([ 'api-key-1', 'api-key-2', ])
Log Context
TBD
Development
Several checkers are available by default if this package is installed with dev-dependencies enabled.
Composer Checks
To run all the checks:
composer ci
To run all static checks:
composer lint
To run only tests:
composer test
PHPUnit
You can run PHPUnit by simply running vendor/bin/phpunit
in the directory the package is installed in. It will
automatically detect the phpunit configuration file for the project, and detect which directory it should run in.
PHPStan
You can run PHPStan by simply running vendor/bin/phpstan
in the directory the package is installed in. It will
automatically detect the phpstan configuration file for the project, and detect which directory it should run in.
PHPCS
You may run PHPCS by running vendor/bin/phpcs src/
in the directory the package is installed in. It will use the
phpcs.xml file defined in the project root directory to determine which coding standards to use.