Skip to content

Commit 5aaeacd

Browse files
committed
Set the logging config when installed
1 parent f9d07c5 commit 5aaeacd

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"name": "transformstudios/front",
33
"require": {
44
"php": "^8.3",
5-
"illuminate/contracts": "^11.0 || ^12.0",
65
"pixelfear/composer-dist-plugin": "^0.1.4",
7-
"statamic/cms": "^5.0 || ^6.0"
6+
"statamic/cms": "^5.0 || ^6.0",
7+
"stillat/proteus": "^4.0"
88
},
99
"require-dev": {
1010
"mockery/mockery": "^1.3.1",
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace TransformStudios\Front\UpdateScripts;
4+
5+
use Illuminate\Support\Facades\App;
6+
use Illuminate\Support\Facades\Config;
7+
use Statamic\UpdateScripts\UpdateScript;
8+
use Stillat\Proteus\Support\Facades\ConfigWriter;
9+
10+
class AddToLoggingConfig extends UpdateScript
11+
{
12+
public function shouldUpdate($newVersion, $oldVersion)
13+
{
14+
return App::isLocal();
15+
}
16+
17+
public function update()
18+
{
19+
if (Config::has('logging.channels.front')) {
20+
return;
21+
}
22+
23+
ConfigWriter::edit('logging')
24+
->set('channels.front', [
25+
'driver' => 'custom',
26+
'via' => \TransformStudios\Front\Logging\Logger::class,
27+
'level' => ConfigWriter::f()->env('FRONT_LOGGING_LEVEL', 'error'),
28+
])->save();
29+
dd('saved');
30+
}
31+
}

0 commit comments

Comments
 (0)