@prairielearn/logger
TypeScript icon, indicating that this package has built-in type declarations

2.0.5 • Public • Published

@prairielearn/logger

Provides a shared Winston instance for all logging.

Usage

import { logger, addFileLogging } from '@prairielearn/logger';

// Log all messages to a file.
addFileLogging({ filename: '/path/to/file.log' });

// Log all errors to another file.
addFileLogging({ filename: '/path/to/errors.log', level: 'error' });

logger.debug('verbose');
logger.verbose('verbose');
logger.info('info');
logger.warn('warn');

try {
  await mightError();
} catch (err) {
  // When logging an error, ensure that the first argument is a string. You can
  // pass the error object as the second argument if desired.
  logger.error('An error occurred', err);
}

Readme

Keywords

none

Package Sidebar

Install

npm i @prairielearn/logger

Weekly Downloads

45

Version

2.0.5

License

none

Unpacked Size

5.72 kB

Total Files

9

Last publish

Collaborators

  • nwalters512
  • mwest1066