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

1.1.0 • Public • Published
CANT.store

  logger

 

NPM size downloads changelog license

CANT inc. log system

stars watchers

Install

npm

npm i @cantinc/logger

yarn

yarn add @cantinc/logger

cdn

<script defer src="https://unpkg.com/@cantinc/logger/logger.min.js"></script>

Usage

Simple example

import logger from '@cantinc/logger'

const eventId = 'test'

logger.start(eventId)

// do somethink

logger.end(eventId)

Complex example

CANT inc. Logger Example

You will get the same picture if you run the next code

logger.start('Main test')

logger.log('Some message')

logger.start('Inside test with message')
logger.log('Inside message')
logger.end('Inside test with message')

logger.start('Inside test without message')
logger.end('Inside test without message')

logger.start('Test with error')
logger.log('Inside message')
logger.end('Test with error', 'Error text')

logger.start('Message Chaining')
logger.next('Message Chaining', 'Step1')
logger.next('Step1', 'Step2')
logger.next('Step2', 'Step3', 'Step2 Error Message')
logger.end('Step3')

logger.start('Callback Running', () => {
  logger.log('Callback Message')
})

logger.start('Async Callback', async () => {
  logger.log('Async Message')
})

logger.start('Async Callback with error', async () => {
  throw Error('Test Error')
})

logger.end('Main test')

Issues

If you find a bug or have a suggestion, please file an issue on GitHub.

issues

Package Sidebar

Install

npm i @cantinc/logger

Weekly Downloads

14

Version

1.1.0

License

MIT

Unpacked Size

17.6 kB

Total Files

21

Last publish

Collaborators

  • deight
  • cant-inc