1.0.1 • Published 6 days ago

consoloo v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 days ago

consoloo

customable colorful logger for nodejs and browser

npm.io npm.io

install

npm install consoloo
yarn add consoloo
pnpm add consoloo

usage

import { createBaseLogger } from 'consoloo/core'
import { createFileTransport, createNodeLogger } from 'consoloo'
import { createBrowserLogger } from 'consoloo/browser'

// basic
const logger = createBaseLogger()

// node
const node = createNodeLogger()
const stop = node.timer('log timer')
node.info('info')
node.warn('warn')
node.error('error')
node.setLogMode('debug')
node.withScope('with').debug('test withScope')
node.info('test inline scope', 'inline')
const scopeLogger = node.withScope('foo')
scopeLogger.warn('test change scope')

const logPath = 'tests/log/test.log'
const fileLogger = createNodeLogger<'file' | 'test'>({
  logMode: 'debug',
  transports: createFileTransport(logPath),
})
fileLogger.debug('info', 'file') // typesafe scope
try {
  throw new Error('test error in file')
} catch (error) {
  fileLogger.error('test error in file', error)
}
stop()

// browser
const browserLogger = createBrowserLogger('debug')

logMode

  • 'debug': debug, info, warn, error
  • 'info': info, warn, error
  • 'error': error
  • 'disable': none
1.0.1

6 days ago

1.0.0

26 days ago

0.7.10

7 months ago

0.7.9

8 months ago

0.7.6

8 months ago

0.7.5

8 months ago

0.7.8

8 months ago

0.7.7

8 months ago

0.8.1

6 months ago

0.7.2

9 months ago

0.8.0

6 months ago

0.7.1

9 months ago

0.6.2

9 months ago

0.3.5

10 months ago

0.7.4

8 months ago

0.8.2

5 months ago

0.7.3

9 months ago

0.5.0

9 months ago

0.3.2

10 months ago

0.4.0

10 months ago

0.7.0

9 months ago

0.6.1

9 months ago

0.3.4

10 months ago

0.6.0

9 months ago

0.3.3

10 months ago

0.3.1

10 months ago

0.2.10

11 months ago

0.3.0

11 months ago

0.2.9

11 months ago

0.2.1

12 months ago

0.2.0

12 months ago

0.2.7

11 months ago

0.2.6

12 months ago

0.2.8

11 months ago

0.2.3

12 months ago

0.2.2

12 months ago

0.2.5

12 months ago

0.1.6

12 months ago

0.2.4

12 months ago

0.1.5

12 months ago

0.1.4-patch1

12 months ago