whiz-logger

1.3.6 • Public • Published

Whiz Logger

Whiz logger for applications based on Winston

Install

npm install whiz-logger

Setup

const logger = require('whiz-logger')({
    environment: "production",
    awsConfig: {
        accessKeyId: process.env.AWS_ACCESS_KEY,
        secretAccessKey: process.env.AWS_SECRET_KEY,
        region: process.env.AWS_REGION,
    },
    projectName: process.env.LOG_GROUP_NAME,
    level: "debug",
    enabledRequestId: true,
});

environment: If it is local, only consoleTransport is enabled.

awsConfig: If the environment is different to local, it is required to set up.

projectName: It is required to works correctly.

level: It is the minimum level allowed logging (debug, warn, info, error).

enabledRequestId: It is necessary use with framework middleware option to initialize the requestId.

Usage

Frameworks

Express Example

// If using with express framework, add the logger middleware right after instantiating express app

const app = express();

// It will log all (request / response), and configure req.id property too
app.use(logger.frameworks.express);

log methods

logger.info("Prueba Info", {anything: true});
// log type: information

logger.warn("Prueba Warn", {anything: true});
// log type: warning

logger.debug("Prueba Debug", {anything: true});
// log type: debug

logger.error("Prueba Error", {anything: true});
// log type: error

Readme

Keywords

none

Package Sidebar

Install

npm i whiz-logger

Weekly Downloads

1

Version

1.3.6

License

ISC

Unpacked Size

42.2 kB

Total Files

13

Last publish

Collaborators

  • luis199230
  • whiz-dev