Needle-Pinpointing Machine

    diy-log
    TypeScript icon, indicating that this package has built-in type declarations

    2.4.0 • Public • Published

    diy-log

    Log things, prefixed with a symbols or timestamp.

    img

    Installation

    npm install diy-log --save-dev

    Usage

    // for cjs
    const logger = require('diy-log')
    const { log, symbols, colors, timestamp } = logger
    
    
    // for esm
    import logger, {
      log,
      colors,
      symbols,
      timestamp
    } from 'diy-log'
    logger.log('message ...')
    logger.time('time ...')
    
    logger.info('info ...')
    logger.success('success ...')
    logger.error('error ...')
    logger.warn('warn ...')
    
    log(symbols.info, 'info ...')
    log(symbols.success, 'success ...')
    log(symbols.error, 'error ...')
    log(symbols.warn, 'warn ...')
    
    // see `picocolors`
    log(
      colors.blue('color: blue;'),
      colors.bgGreen('bgcolor: green;'),
      colors.bold('font-weight: bold;'),
      colors.italic('font-style: italic')
    )
    
    // see `time-stamp`
    log(
      colors.bgRed(timestamp('YYYY/MM/DD HH:mm:ss'))
    )

    Thanks

    Install

    npm i diy-log

    DownloadsWeekly Downloads

    71

    Version

    2.4.0

    License

    MIT

    Unpacked Size

    4.52 kB

    Total Files

    4

    Last publish

    Collaborators

    • mengqing723