UNPKG

todo-txt-cli

Version:

A CLI for todo.txt files - http://todotxt.org/

25 lines (21 loc) 516 B
import debug from 'debug' const _process = typeof process === 'undefined' ? {} : process /** * decoupled logger * @param {string} namespace * @returns {{debug: (...args) => void}} */ export const logger = (namespace) => { const _namespace = `todo-txt-cli:${namespace}` return { debug: (...args) => _process.emit?.('debug', _namespace, ...args) } } /** * initialize logger */ export const initLogger = () => { _process.on?.('debug', (namespace, ...args) => { debug(namespace)(...args) }) }