@printy/logger

1.0.1 • Public • Published

Logger

A basic logging utility class. Supports prefixes, enabled/disabled state and tags/filters.

This package is useful for when you have a lot of different logs and you want to filter them out quickly without needing to remove them/comment them out.

Usage:

import Logger from "@printy/logger"

//--Basic usage--//

const logger = new Logger(true, 'My log')

logger.log('This is my log!')

//Output: 
//My log: This is my log!

//--Disabling--//

logger.enabled = false

logger.log('This won\'t log!')

//Output:

//--Filters--//

logger.enabled = true

logger.filters = ["filter1", "filter2"]

logger.log('This will log!', 'filter1')

logger.log('This will also log!', 'filter2')

logger.log('This won\'t log!', 'filter3')

//Output:
//My log: This will log!
//My log: This will also log!

Package Sidebar

Install

npm i @printy/logger

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

3.38 kB

Total Files

4

Last publish

Collaborators

  • jorensm