-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.php
executable file
·42 lines (36 loc) · 1001 Bytes
/
app.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
// Init config data
use App\Helpers\Config;
use Slim\Slim;
use Slim\Log;
use Slim\Extras\Log\DateTimeFileWriter;
// Basic config for Slim Application
$config= [
'name' => Config::get('app.name'),
'log.enabled' => true,
'log.level' => Log::INFO,
'log.writer' => new DateTimeFileWriter([
'path' => dirname(__FILE__) . '/../storage/logs',
]),
'mode' => Config::get('app.debug') ? 'development' : 'production',
];
// Create application instance with config
$app = new Slim($config);
// Get logger
$log = $app->getLog();
// Only invoked if mode is "production"
$app->configureMode('production', function () use ($app) {
$app->config([
'log.enable' => true,
'log.level' => Log::WARN,
'debug' => false,
]);
});
// Only invoked if mode is "development"
$app->configureMode('development', function () use ($app) {
$app->config([
'log.enable' => true,
'log.level' => Log::DEBUG,
'debug' => true,
]);
});