Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/razonyang/yii2-log-target-db
Yii2 enhanced database log target
https://github.com/razonyang/yii2-log-target-db
Last synced: 20 days ago
JSON representation
Yii2 enhanced database log target
- Host: GitHub
- URL: https://github.com/razonyang/yii2-log-target-db
- Owner: razonyang
- License: bsd-3-clause
- Created: 2019-08-14T03:27:10.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-21T05:03:57.000Z (about 5 years ago)
- Last Synced: 2024-04-14T02:23:41.191Z (7 months ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Yii2 enhanced database log target
=================================[![Build Status](https://travis-ci.org/razonyang/yii2-log-target-db.svg?branch=master)](https://travis-ci.org/razonyang/yii2-log-target-db)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/razonyang/yii2-log-target-db/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/razonyang/yii2-log-target-db/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/razonyang/yii2-log-target-db/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/razonyang/yii2-log-target-db/?branch=master)
[![Latest Stable Version](https://img.shields.io/packagist/v/razonyang/yii2-log-target-db.svg)](https://packagist.org/packages/razonyang/yii2-log-target-db)
[![Total Downloads](https://img.shields.io/packagist/dt/razonyang/yii2-log-target-db.svg)](https://packagist.org/packages/razonyang/yii2-log-target-db)
[![LICENSE](https://img.shields.io/github/license/razonyang/yii2-log-target-db)](LICENSE)Because the built-in database log target can not figure out the context of same request, especially in the case of concurrency,
so that the log is very confusing, it is hard to diagnose errors.According this problem, what this extension do is that record the request ID via `dechex($_SERVER['REQUEST_TIME_FLOAT'] * 1000000)`.
Installation
------------```
composer require razonyang/yii2-log-target-db
```Usage
-----```php
return [
// console configuration
'controllerMap' => [
'migrate' => [
'migrationPath' => [
// ...
'@yii/log/migrations/',
],
'migrationNamespaces' => [
// ...
'RazonYang\Yii2\Log\Db\Migration',
],
],
],// common/web/console configuration
'components' => [
'log' => [
'targets' => [
'db' => [
'class' => \RazonYang\Yii2\Log\Db\Target::class,
'levels' => ['error', 'warning'],
'db' => 'db',
'logTable' => '{{%log}}',
],
],
],
],
];
```then:
```shell
$ yii migrate
```