blear.node.debug

1Introduction

2Example

var debug = require('blear.node.debug');

debug.primary('debug', 'primary');
debug.success('debug', 'success');
debug.info('debug', 'info');
debug.warning('debug', 'warning');
debug.warn('debug', 'warn');
debug.error('debug', 'error');
debug.danger('debug', 'danger');
debug.normal('debug', 'normal');
debug.ignore('debug', 'ignore');

3Static

3.1.config(key, [val]): ret

配置默认值。默认配置为:

var configs = {
    // 内边距
    padding: 20,
    // 对齐方式
    align: 'right',
    // 键值分隔符
    separator: ' → ',
    // 附加颜色
    colors: []
};

3.1.1key

  • 类型:String
  • 说明:键名

3.1.2val

  • 类型:String
  • 说明:键值,如果有值,则为设置默认值

3.1.3ret

  • 类型:String
  • 说明:键值,返回 key 对应的默认配置

3.2.primary(key, msg): undefined

输出主要类型调试消息。

3.2.1key

  • 类型:String
  • 说明:消息键

3.2.2msg

  • 类型:String
  • 说明:消息值

3.3.success(key, msg): undefined

输出成功类型调试消息。

3.3.1key

  • 类型:String
  • 说明:消息键

3.3.2msg

  • 类型:String
  • 说明:消息值

3.4.info(key, msg): undefined

输出消息类型调试消息。

3.4.1key

  • 类型:String
  • 说明:消息键

3.4.2msg

  • 类型:String
  • 说明:消息值

3.5.warning(key, msg): undefined

输出警告类型调试消息。

3.5.1key

  • 类型:String
  • 说明:消息键

3.5.2msg

  • 类型:String
  • 说明:消息值

3.6.warn(key, msg): undefined

输出警告类型调试消息。

3.6.1key

  • 类型:String
  • 说明:消息键

3.6.2msg

  • 类型:String
  • 说明:消息值

3.7.error(key, msg): undefined

输出错误类型调试消息。

3.7.1key

  • 类型:String
  • 说明:消息键

3.7.2msg

  • 类型:String
  • 说明:消息值

3.8.danger(key, msg): undefined

输出危险类型调试消息。

3.8.1key

  • 类型:String
  • 说明:消息键

3.8.2msg

  • 类型:String
  • 说明:消息值

3.9.normal(key, msg): undefined

输出普通类型调试消息。

3.9.1key

  • 类型:String
  • 说明:消息键

3.9.2msg

  • 类型:String
  • 说明:消息值

3.10.ignore(key, msg): undefined

输出忽略类型调试消息。

3.10.1key

  • 类型:String
  • 说明:消息键

3.10.2msg

  • 类型:String
  • 说明:消息值

3.11.wait(key, msg, options): undefined

输出等待类型调试消息。

var i = 0;
var j = 20;
var next = function () {
    if (i > j) {
        debug.waitEnd('find', i, {
            colors: ['red', 'bold']
        });
        return;
    }

    debug.wait('go', i, {
        colors: ['red', 'bold']
    });
    i++;
    setTimeout(next, 300);
};

next();

3.11.1key

  • 类型:String
  • 说明:消息键

3.11.2msg

  • 类型:String
  • 说明:消息值

3.11.3options

  • 类型:Object
  • 说明:配置,参考 .config()

3.12.waitEnd(key, msg, options): undefined

结束输出等待类型调试消息。

3.12.1key

  • 类型:String
  • 说明:消息键

3.12.2msg

  • 类型:String
  • 说明:消息值

3.12.3options

  • 类型:Object
  • 说明:配置,参考 .config()

4Dependencies

5Reference

无。