Skip to content

Commit

Permalink
Configurable Logging - Defaults to STDIN
Browse files Browse the repository at this point in the history
  • Loading branch information
Lewiscowles1986 committed Jan 28, 2020
1 parent 0340e98 commit 73c66eb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ TWITTER_CLIENT_ID=
TWITTER_CLIENT_SECRET=

REDIS_URL=tcp://127.0.0.1:6379

LOGGER_PATH=logs/app.log
5 changes: 5 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@
"description": "PGP Verification API URL",
"value": "",
"required": false
},
"LOGGER_PATH": {
"description": "File path for logging (defaults to stdin)",
"value": "php://stdin",
"required": true
}
},
"formation": {
Expand Down
2 changes: 1 addition & 1 deletion lib/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function installDB() {

function make_logger($channel) {
$log = new Logger($channel);
$log->pushHandler(new StreamHandler(dirname(__FILE__).'/../logs/app.log', Logger::DEBUG));
$log->pushHandler(new StreamHandler(getenv('LOGGER_PATH'), Logger::DEBUG));
$log->pushProcessor(new Monolog\Processor\WebProcessor);
return $log;
}
Expand Down

0 comments on commit 73c66eb

Please sign in to comment.