npm.io
1.2.0 • Published 3 years ago

@leanylabs/logger

Licence
MIT
Version
1.2.0
Deps
2
Size
12 kB
Vulns
0
Weekly
0

Usage

You have two ways to use the lib:

  1. With default env variables name (which are: LOGGING_LEVEL, SERVICE_NAME and isProd which depends on NODE_ENV either including partial string 'prod' or not), the values of the variables must be defined in your process enviroment
const { logger } = require("@leanylabs/logger");

logger.info("hello world");
  1. Pass the needed variables manually into initially imported function 'createLogger' and then by means of in create the logger itself
const { createLogger } = require("@leanylabs/logger");

const logger = createLogger({
  isProduction: false,
  level: "silly",
  labels: {
    serviceName: "test",
  },
});