tourze / json-rpc-log-bundle
JsonRPC日志实现
Installs: 3 427
Dependents: 4
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^8.1
- doctrine/dbal: ^4.0
- doctrine/doctrine-bundle: ^2.13
- doctrine/persistence: ^3.1 || ^4
- monolog/monolog: ^3.1
- psr/log: ^3|^2|^1
- symfony/config: ^6.4
- symfony/dependency-injection: ^6.4
- symfony/event-dispatcher-contracts: ^2.5 | ^3
- symfony/framework-bundle: ^6.4
- symfony/http-kernel: ^6.4
- symfony/service-contracts: ^3.5
- symfony/stopwatch: ^6.4
- symfony/yaml: ^6.4 || ^7.1
- tourze/backtrace-helper: ~0.0.5
- tourze/doctrine-async-bundle: ^0.0.6
- tourze/doctrine-helper: 0.0.*
- tourze/doctrine-indexed-bundle: 0.0.*
- tourze/doctrine-ip-bundle: 0.0.*
- tourze/doctrine-snowflake-bundle: 0.1.*
- tourze/doctrine-timestamp-bundle: 0.0.*
- tourze/doctrine-user-agent-bundle: 0.0.*
- tourze/doctrine-user-bundle: 0.0.*
- tourze/easy-admin-attribute: 0.1.*
- tourze/json-rpc-core: ^0.0.6
- tourze/symfony-schedule-entity-clean-bundle: 0.1.*
- yiisoft/json: ^1.0
- yiisoft/strings: ^2.1
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^10.0
README
A Symfony bundle for logging JsonRPC server requests and responses, supporting async database storage, request/response/exception logging, stopwatch timing, and rich integration with the Tourze ecosystem.
Features
- Logs important JsonRPC requests and responses to database
- Async log writing with Doctrine
- Stopwatch duration and result tracking
- Exception and error capturing
- Integrates with Tourze bundles (IP/User/UserAgent/Snowflake/Timestamp, etc.)
- Supports log export and admin viewing
- Customizable log format via event
Installation
- PHP >= 8.1
- Symfony >= 6.4
- Install via Composer:
composer require tourze/json-rpc-log-bundle
- Requires database setup (Doctrine ORM)
- Ensure required Tourze bundles are installed (see composer.json)
Quick Start
- Register the bundle in your
config/bundles.php
if not auto-registered. - Run migrations to create the
json_rpc_log
table. - Use JsonRPC server as usual; important requests will be logged automatically.
- View logs via admin or query the database.
Example Usage
// Logs are written automatically when using tourze/json-rpc-core server // Customize logging by adding #[Log] attribute to your JsonRPC method class
Configuration
- Control log retention with
JSON_RPC_LOG_PERSIST_DAY_NUM
env var - Log result/request/response via #[Log] attribute
Advanced
- Supports async log insertion for high performance
- Integrates with Tourze EasyAdmin for UI
- Provides full request/response/exception/context info
Contributing
- Submit issues via GitHub
- Pull requests welcome, follow PSR-12 code style
- Run tests with PHPUnit
License
MIT License. Copyright (c) tourze
Changelog
See CHANGELOG for version history and upgrade notes.