--time to enable log date prefixing

This commit is contained in:
Unitech 2018-09-24 00:17:23 +02:00
parent 0f1c2c6a24
commit 3e3077698c
3 changed files with 9 additions and 1 deletions

View File

@ -46,6 +46,7 @@ commander.version(pkg.version)
.option('-l --log [path]', 'specify log file which gathers both stdout and stderr')
.option('--log-type <type>', 'specify log output style (raw by default, json optional)')
.option('--log-date-format <date format>', 'add custom prefix timestamp to logs')
.option('--time', 'enable time logging')
.option('--disable-logs', 'disable all logs storage')
.option('--env <environment_name>', 'specify which set of environment variables from ecosystem file must be injected')
.option('-a --update-env', 'force an update of the environment with restart/reload (-a <=> apply)')

View File

@ -70,6 +70,9 @@
"type": "string",
"docDescription": "Format for log timestamps in moment.js format (eg YYYY-MM-DD HH:mm Z)"
},
"time": {
"type": "boolean"
},
"env": {
"type": [
"object",

View File

@ -626,10 +626,14 @@ Common.verifyConfs = function(appConfs) {
/**
* Add log_date_format by default
*/
if (!app.log_date_format) {
if (app.time) {
app.log_date_format = 'YYYY-MM-DDTHH:mm:ss'
}
if (app.no_time) {
app.log_date_format = null
}
/**
* Checks + Resolve UID/GID
* comes from pm2 --uid <> --gid <> or --user