JSPM

  • Created
  • Published
  • Downloads 1834
  • Score
    100M100P100Q114661F
  • License Apache-2.0

base component

Package Exports

  • @well-known-components/logger
  • @well-known-components/logger/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@well-known-components/logger) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

logger component

Simple stdout & stderr logger component. Prints JSON when NODE_ENV=production

Config

logLevel

Adjust the default level to be used for logging. It will log everything after the assigned level according to the following hierarchy:

"ALL" > "LOG" > "DEBUG" > "INFO" > "WARN" > "ERROR" > "OFF"

Eg:

const config = { logLevel: "INFO" } // Set the log level
const loggerComponent = createLogComponent({ config })
const logger = getLogger("Test")

logger.info("log some info") // This will be logged
logger.warn("log some warn") // This will be logged
logger.debug("log some debug") // This will NOT be logged