1.0.1 • Published 7 months ago

@printy/logger v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

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!