> For the complete documentation index, see [llms.txt](https://tarscloud.gitbook.io/tarsdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tarscloud.gitbook.io/tarsdocs/tars.js/tars-notify.md).

# @tars/notify

## @tars/notify

上报业务（框架）消息（告警）至 `TARS` 平台。

### report(message\[, id])

将消息上报到平台上，并可以在WEB管理页面上查看到。

* *message*: 消息内容（ **必填** ）
* *id*: 服务线程（进程）ID， *默认值为 process.pid*

### notify(message\[, level, id])

上报通知信息到平台。

* *message*: 通知内容（ **必填** ）
* *level*: 通知内容的级别，为 LEVEL 枚举， *默认值为 LEVEL.NOTIFYNORMAL*
* *id*: 服务线程（进程）ID， *默认值为 process.pid*

`LEVEL` 枚举中有3项可选：

* *LEVEL.NOTIFYNORMAL*: 正常（默认）
* *LEVEL.NOTIFYWARN*: 警告
* *LEVEL.NOTIFYERROR*: 错误

平台每10分钟对上报的异常进行收敛告警。

如果结合: <http://alarm.k.tarsyun.com/alarms/index.html#/document>, 能快速将异常通知到您!
