# xsm-debug-utils

> debug utils

Latest version **0.1.0** (published 2016-01-19) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install xsm-debug-utils
pnpm add xsm-debug-utils
yarn add xsm-debug-utils
bun add xsm-debug-utils
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2016-01-19 |
| First published | 2016-01-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | xsm-ue |
| Maintainers | luobotang |
| Keywords | debug |

## Links

- npm: https://www.npmjs.com/package/xsm-debug-utils
- Repository: https://github.com/xsm-ue/xsm-debug-utils
- Homepage: https://github.com/xsm-ue/xsm-debug-utils#readme
- Issues: https://github.com/xsm-ue/xsm-debug-utils/issues
- npm.io page: https://npm.io/package/xsm-debug-utils

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 0.1.0 (latest) — 2016-01-19

## README

# xsm-debug-utils

xsm debug utils

# 使用方法

(一) 引入 'xsm-debug-utils'，获取当前模块内部使用的 debug 方法

```javascript
var XSMDebugUtils = require('xsm-debug-utils')

var debug = XSMDebugUtils.channel('my-module')

function test(name) {
    debug('test()', name)
    // ...
}
```

(二) 开启页面 debug 模式

页面地址添加查询参数 ```xsm-debug```，值为 ```true```，例如：

```hash
http://sample.com/path/to/page.htm?xsm-debug=true
```

(三) 输出调试信息

调用 ```test('luobo')``` 则浏览器控制台输出：

```hash
[my-module] test() luobo
```

# API

## channel(channelName)

返回一个 debug 函数，输出消息前会添加指定的 channelName。

## debug(arg1, arg2, ...)

以空格连接所有输入参数，在可以进行 debug 输出的情况下，向控制台打印消息。如果参数类型非 string 类型，则通过 JSON.stringify() 的方式进行序列化后输出。

---
_Source: https://npm.io/package/xsm-debug-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
