96bed71022
* Improves error logging
- use pino error logger correctly by passing in error as first argument
* monitor deployment: Filter logging at INFO level and above
* Use structured logging to create parameters for monitoring results
* Add structured logging to obj fileimport service
* Fileimport service, fix and improve logging
- use child logger with additional context where possible
- select appropriate logging level
- fix duplicated context in log statement
* REST endpoints, add context to structured logging and remove same context from message
* Webhook service provides context to bound logger to properly use structured logging
- Pass bound logger containing context to `makeNetworkRequest`
- do not log url, as it may contain a secret (like Discord's webhook urls), instead log the webhook Id
- log error message when network call fails
* upload: make better use of structured logging when recording data
* pino-pretty when in dev or test mode
- pino-pretty configured to send to stderr
* LOG_PRETTY env var
* Silence structured logging during testing
- can not rely on determining the port number by reading from stdout/stderr
- instead we determine which port is free, then create our server on that port
- we then poll that port until the server is ready before commencing tests
* Allow puppeteer to install chromium
* Do not need to install chromium separately
30 lines
822 B
JavaScript
30 lines
822 B
JavaScript
const path = require('path')
|
|
const yargs = require('yargs')
|
|
require('../../bootstrap')
|
|
const { logger } = require('@/logging/logging')
|
|
|
|
const execution = yargs
|
|
.scriptName('yarn cli')
|
|
.usage('$0 <cmd> [args]')
|
|
.commandDir(path.resolve(__dirname, './commands'), { extensions: ['js', 'ts'] })
|
|
.demandCommand()
|
|
.fail((msg, err, yargs) => {
|
|
if (!err) {
|
|
// If validation error (no err instance) then just show help and show the message
|
|
console.log(yargs.help())
|
|
console.log('\n', msg)
|
|
} else {
|
|
// If actual app error occurred, show the msg, but don't show help info
|
|
logger.error(err)
|
|
console.log('\n', 'Specify --help for available options')
|
|
}
|
|
|
|
process.exit(1)
|
|
})
|
|
.help().argv
|
|
|
|
const promise = Promise.resolve(execution)
|
|
promise.then(() => {
|
|
yargs.exit(0)
|
|
})
|