This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@forrestjs/service-logger

5.0.3 • Public • Published

@forrestjs/service-logger (deprecated)

ForrestJS service which helps logging stuff in the server. It uses winston under the hood.

Usage

service-logger injects a Winston logger instance into the App context, so you will be able to access it from any action:

registerAction({
  target: '$FINISH',
  handler: (args, ctx) => {
    ctx.logger.info('Test');
  },
});

After the Hooks App gets initialized, you can also access some direct logging methods by importing them directly:

const logger = require('@forrestjs/service-logger');
logger.logInfo('test...');

Configuration

Environment

NOTE: it is important to list service-logger AFTER service-env so that any kind of environment configuration is available to be used.

LOG_LEVEL should be set according to the winston docs and it defaults to info.

Config

logger.level should be set according to the winston docs and it default to process.env.LOG_LEVEL.

Provide custom transporters

In order to add your custom transporters you must register your extension as a service or as a standalone hook before running createHookApp, as Service Logger hooks into START with the purpose of providing the rest of the app with a viable logging mechanism.

const serviceLogger = require('@forrestjs/service-logger');

registerAction({
  target: '$LOGGER_TRANSPORTS',
  handler: ({ registerTransport, winston }) =>
    registerTransport(new winston.transports.Console()),
});

Package Sidebar

Install

npm i @forrestjs/service-logger

Weekly Downloads

1,039

Version

5.0.3

License

MIT

Unpacked Size

6.39 kB

Total Files

4

Last publish

Collaborators

  • marcopeg