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

1.2.1 • Public • Published

pure-logger

A minimalistic logger for Typescript / Javascript projects (backend, browser and mobile):

  • Minimum setup
  • Extends the console with the purpose of get rid of the overhead of logging
  • Optional Rollbar support
  • Optional Cloudwatch support

Tested with Node applications, React and React Native, it should work with any other node applications without a problem.

Installation

npm install @cobuildlab/pure-logger

Examples:

Simple

import { log, error } from '@cobuildlab/pure-logger';

// Logs any to the console
await log('a', 1, 2, { a: 2 });

// Logs any to the console and raises an error
await log.error(new Error('Test'), { s: 1 }, true, 1);

Cloudwatch

import { createLogger } from '@cobuildlab/pure-logger';

const { log } = createLogger({
  cloudWatch: {
    accessKeyId: env.AWS_ACCESS_KEY_ID ?? '',
    secretAccessKey: env.AWS_SECRET_ACCESS_KEY ?? '',
    region: env.AWS_REGION ?? '',
    logGroupName: 'cli',
    logStreamName: 'local',
  },
});

await log('test');
await log('test1');
await log('test2');
await log('test3');
await log('test4');

Readme

Keywords

none

Package Sidebar

Install

npm i @cobuildlab/pure-logger

Weekly Downloads

25

Version

1.2.1

License

GPL-3.0

Unpacked Size

47.9 kB

Total Files

37

Last publish

Collaborators

  • alacret
  • nodejose
  • lesha12012
  • galue99