• [Debug] debug module


    Install:

    npm i debug supports-color --save

    Docs

    Code:

    // stdout.js
    
    var debug = require('debug');
    var error = debug('app:error');
    
    // by default stderr is used
    error('goes to stderr!');
    
    var log = debug('app:log');
    // set this namespace to log via console.log
    log.log = console.log.bind(console); // don't forget to bind to console!
    log('goes to stdout');
    error('still goes to stderr!');
    
    // set all output to go via console.info
    // overrides all per-namespace log settings
    debug.log = console.info.bind(console);
    error('now goes to stdout via console.info');
    log('still goes to stdout, but via console.info now');

    If you just run:

    node ./stdout.js

    Nothing will be output.

    You have to run:

    Apply wildcards:

  • 相关阅读:
    省选前模拟
    $SA$后缀数组
    一键运行
    多项式$fft$,$ntt$,$fwt$初步
    插头$DP$初步
    网络流初步
    欧拉路相关
    模板—Hash_map
    HZOJ Function
    HZOJ Tree
  • 原文地址:https://www.cnblogs.com/Answer1215/p/12392092.html
Copyright © 2020-2023  润新知