Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sailor should be more tolerant of invalid LOG_LEVEL values #159

Open
jhorbulyk opened this issue Oct 16, 2020 · 0 comments
Open

Sailor should be more tolerant of invalid LOG_LEVEL values #159

jhorbulyk opened this issue Oct 16, 2020 · 0 comments

Comments

@jhorbulyk
Copy link

Consider the following cases:

  • A user enters IFNO as the LOG_LEVEL env var for a component
  • A user enters INFO (with lead space) as the LOG_LEVEL env var for a component
  • A user enters INFO, DEBUG as the LOG_LEVEL env var for a component (doesn't logging understand heirarchy)

Results in the following exception being thrown on virtually any action involving the component:

throw new Error(format('unknown level name: "%s"', nameOrNum));
(no message)
at resolveLevel (/home/apprunner/node_modules/elasticio-sailor-nodejs/node_modules/bunyan/lib/bunyan.js:293:19)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
/home/apprunner/node_modules/elasticio-sailor-nodejs/node_modules/bunyan/lib/bunyan.js:293
at Logger.addStream (/home/apprunner/node_modules/elasticio-sailor-nodejs/node_modules/bunyan/lib/bunyan.js:570:19)
at new Logger (/home/apprunner/node_modules/elasticio-sailor-nodejs/node_modules/bunyan/lib/bunyan.js:490:18)
at Function.createLogger (/home/apprunner/node_modules/elasticio-sailor-nodejs/node_modules/bunyan/lib/bunyan.js:1618:12)
at Object.<anonymous> (/home/apprunner/node_modules/elasticio-sailor-nodejs/lib/logging.js:36:20)
at Module.require (internal/modules/cjs/loader.js:952:19)
^
Error: unknown level name: "IFNO"
at Module._compile (internal/modules/cjs/loader.js:1063:30)

Ideally sailor should be more resillient and log an error while falling back to the defaults so that things don't catastrophically break on minor configuration errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant