Skip to content

Commit e59a29b

Browse files
author
Daniel Mellum
committed
Fix some issues happening in Lumen, and try github action testing one last time :[
1 parent 11fc22f commit e59a29b

File tree

8 files changed

+21
-16
lines changed

8 files changed

+21
-16
lines changed

.github/workflows/docker.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- dev
78
pull_request:
89
branches:
910
- main
@@ -22,12 +23,15 @@ jobs:
2223
run: cd /var/testing && composer install --no-interaction
2324

2425
- name: Run tests
25-
run: cd /var/testing && dockerize -wait tcp://mariadb:3306 -timeout 1m && ./vendor/bin/testbench package:test
26+
run: ">
27+
cd /var/testing && dockerize -wait tcp://mariadb:3306 -timeout 1m
28+
&& ./vendor/bin/phpunit --coverage-clover ./coverage.xml
29+
"
2630

2731
- name: Upload test coverage
2832
uses: codecov/codecov-action@v3
2933
with:
30-
files: ./clover.xml
34+
files: ./coverage.xml
3135

3236
- name: Cleanup containers
3337
run: docker-compose down

docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ services:
2424
php8:
2525
image: ghcr.io/danielme85/lltdb-testbench
2626
container_name: laravel-log-to-db-php8
27+
tty: true
2728
build:
2829
context: ./docker/php8/
2930
dockerfile: Dockerfile

phpunit.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
<exclude>
1111
<directory>./vendor</directory>
1212
</exclude>
13-
<report>
14-
<clover outputFile="./clover.xml"/>
15-
</report>
1613
</coverage>
1714
<testsuites>
1815
<testsuite name="Test Suite danielme85/laravel-log-to-db">

readme.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,8 @@ You also need to make sure that all the needed basic config values for logtodb i
415415
* or just add all your log-to-db options in your applications config/logging.php file (probably easiest). Just follow the
416416
configuration example above under the [configuration](#configuration) section.
417417

418+
Since we are using Lumen we need to specify the config and service providers in the "bootstrap/app.php" file.
419+
418420
```
419421
/*
420422
|--------------------------------------------------------------------------
@@ -452,9 +454,9 @@ Next step is to register the service provider, either in bootstrap/app.php or in
452454
$app->register(\danielme85\LaravelLogToDB\ServiceProvider::class);
453455
```
454456

455-
After adding the service provider you should be able to run the database migration with:
457+
After adding the service provider you should be able to run the database migration in Lumen with:
456458
```
457-
php artisan migrate
459+
php artisan migrate --path=vendor/danielme85/laravel-log-to-db/src/migrations/2018_08_11_003343_create_log_table.php
458460
```
459461
Please note that you need a working db connection in Lumen at this point.
460462

src/LogToDB.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function newFromMonolog(array $record)
150150
} else if (!$detailed) {
151151
$record['context'] = null;
152152
}
153-
if ($this->config['queue']) {
153+
if (!empty($this->config['queue'])) {
154154
if (empty($this->config['queue_name']) && empty($this->config['queue_connection'])) {
155155
dispatch(new SaveNewLogEvent($this, $record));
156156
} else if (!empty($this->config['queue_name']) && !empty($this->config['queue_connection'])) {

src/LogToDbCustomLoggingHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class LogToDbCustomLoggingHandler extends AbstractProcessingHandler
2525
/**
2626
* LogToDbHandler constructor.
2727
*
28-
* @param array $config Logging configuration from logging.php8
28+
* @param array $config Logging configuration from logging.php
2929
* @param array $processors collection of log processors
3030
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
3131
*/

src/ServiceProvider.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public function boot()
2727
{
2828
//config path is missing in Lumen
2929
//https://gist.github.com/mabasic/21d13eab12462e596120
30-
if (!function_exists('config_path')) {
30+
if (!function_exists('config_path') &&
31+
!function_exists('danielme85\LaravelLogToDB\config_path')) {
3132
function config_path($path = '')
3233
{
3334
return app()->basePath() . '/config' . ($path ? '/' . $path : $path);
@@ -37,7 +38,7 @@ function config_path($path = '')
3738
//Merge config first, then keep a publish option
3839
$this->mergeConfigFrom(__DIR__.'/config/logtodb.php', 'logtodb');
3940
$this->publishes([
40-
__DIR__.'/config/logtodb.php' => config_path('logtodb.php8'),
41+
__DIR__.'/config/logtodb.php' => config_path('logtodb.php'),
4142
], 'config');
4243

4344
//Publish the migration

src/config/logtodb.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
|--------------------------------------------------------------------------
66
|
77
| These settings are ONLY USED if they are not specified per channel
8-
| in the config/logging.php8 file.
8+
| in the config/logging.php file.
99
|
1010
*/
1111
return [
@@ -15,11 +15,11 @@
1515
|--------------------------------------------------------------------------
1616
|
1717
| Set the default database connection to use. This is only used if no connection
18-
| is specified in config/logging.php8. Matches connections in the config/database.php8.
18+
| is specified in config/logging.php. Matches connections in the config/database.php.
1919
| The default is: 'default', this will use whatever is default in the Laravel DB
2020
| config file. To use a different or separate connection set the connection name here.
21-
| Ex: 'connection' => 'mysql' wil use the connection 'mysql' in database.php8.
22-
| Ex: 'connection' => 'mongodb' wil use the connection 'mongodb' in database.php8*
21+
| Ex: 'connection' => 'mysql' wil use the connection 'mysql' in database.php.
22+
| Ex: 'connection' => 'mongodb' wil use the connection 'mongodb' in database.php*
2323
|
2424
| Supported connections should be same as Laravel since the Laravel DB/Eloquent
2525
| Supported DB engines as of this writing: [MySQL] [PostgreSQL] [SQLite] [SQL Server]
@@ -89,7 +89,7 @@
8989
|
9090
| If you are working with multiple queue connections, you may specify which
9191
| connection to push a job to.
92-
| This relates yto your queue settings in the config/queue.php8 file.
92+
| This relates yto your queue settings in the config/queue.php file.
9393
| Leave blank to use the default connection.
9494
|
9595
*/

0 commit comments

Comments
 (0)