Skip to content

Sailor should be more tolerant of invalid LOG_LEVEL values #159

Description

@jhorbulyk

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions