Refactor logging to provide common logger from LoggerAdapter (#2478)

* Refactor logging to provide common logger from LoggerAdapter

Move logger logic de WinstonLoggerAdapter

Further improvements in configuration

Use logger instead of getLogger

- Removes PLog module

Reverts name changes

nits

* Adds additional logging levels as requirements

* Adds tests for logging configuration

* removes flaky test

* investigate...

* further investigation

* Adds silent option to disable console output

* Restores logs with VERBOSE in tests

* Expose controller instead of adapter, reduces method requirements for adapter

* Shuffles initializations around

* Fix doc

* Load cloudCode last to make sure the logger is available

* Adds test to make sure we can load an adapter from npm module

* extract defaults

* Adds defaultMongoURI to defaults

* fix defaults values

* Proper error for PG failures

* Disable flaky test
This commit is contained in:
Florent Vilmart
2016-08-12 13:25:24 -04:00
committed by Drew
parent 6e0a25dea0
commit a5a172918e
28 changed files with 396 additions and 293 deletions

View File

@@ -32,6 +32,13 @@ function booleanParser(opt) {
return false;
}
function nullParser(opt) {
if (opt == 'null') {
return null;
}
return opt;
}
export default {
"appId": {
env: "PARSE_SERVER_APPLICATION_ID",
@@ -193,6 +200,18 @@ export default {
env: "JSON_LOGS",
help: "Log as structured JSON objects"
},
"logLevel": {
env: "PARSE_SERVER_LOG_LEVEL",
help: "Sets the level for logs"
},
"logsFolder": {
env: "PARSE_SERVER_LOGS_FOLDER",
help: "Folder for the logs (defaults to './logs'); set to null to disable file based logging",
action: nullParser
},
"silent": {
help: "Disables console output",
},
"revokeSessionOnPasswordReset": {
env: "PARSE_SERVER_REVOKE_SESSION_ON_PASSWORD_RESET",
help: "When a user changes their password, either through the reset password email or while logged in, all sessions are revoked if this is true. Set to false if you don't want to revoke sessions.",