npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

tencentcloud-cls-sdk-nodejs

v1.0.1

Published

TencentCloud CLS Javascript SDK

Downloads

113

Readme

CLS JavaScript SDK

腾讯云CLS日志上传SDK, 支持nodejs

安装指令

npm i tencentcloud-cls-sdk-nodejs

参数描述

ProducerOptions Interface

| Property | Type | Description | Optional | |----------|------|-------------|----------| | topic_id | string | The cls service topic id (e.g. "xxxx-xxxx-xxxx-xxxx") | No | | endpoint | string | The cls service topic region endpoint URL (e.g. "ap-guangzhou.cls.tencentcs.com") | No | | credential | Credential | Authentication information | No | | sourceIp | string | client ip | Yes | | sendTimeout | number | Request timeout in seconds, default 60s | Yes | | time | number | 发送时间阈值, default 2s | Yes | | count | number | 发送条数阈值, default 1000 | Yes | | onSendLogsError | function | 上传回调 | Yes | | maxMemLogCount | number | 最大内存存储的数据长度, default 10000 | Yes |

Credential Interface

| Property | Type | Description | Optional | |----------|------|-------------|----------| | secretId | string | Tencent Cloud account secretId and secretKey | No | | secretKey | string | Tencent Cloud account secretKey | No | | token | string | Tencent Cloud account token (mutually exclusive with secretId) | Yes |

注意:

endpoint填写请参考可用地域API上传日志 Tab中的域名image-20230403191435319

本文档详细说明 CLS Producer 的两种日志发送接口:异步发送 send和同步发送 sendImmediate。

异步发送接口 send

public async send(log: LogItem): Promise<void>

使用方式

let client = new Producer({
    endpoint: "ap-xian-ec.cls.tencentyun.com",
    topic_id: "dbb3d9f9-47fc-46f5-a0ee-",
    credential: {
        secretId: "**",
        secretKey: "**",
        token: ""
    },
});
let item = new LogItem()
item.pushBack(new Content("__CONTENT__", "你好,我来自深圳|hello world"))
item.setTime(Math.floor(Date.now() / 1000))
try {
    let message = await client.send(item);
} catch (error) {
    if (error instanceof TencentCloudClsSDKException) {
        console.log(error.toString())
    } else {
        console.log(error)
    }
}        

同步发送接口

public async sendImmediate(logs: LogItem[]): Promise<ClsMessage>

使用文档

let client = new Producer({
    endpoint: "ap-xian-ec.cls.tencentyun.com",
    topic_id: "dbb3d9f9-47fc-46f5-a0ee-",
    credential: {
        secretId: "**",
        secretKey: "**",
        token: ""
    },
});
let items: LogItem[] = []
let item = new LogItem()
item.pushBack(new Content("__CONTENT__", "你好,我来自深圳|hello world"))
item.setTime(Math.floor(Date.now() / 1000))
items.push(item)
try {
    let message = await client.sendImmediate(items);
    console.log(message)
} catch (error) {
    if (error instanceof TencentCloudClsSDKException) {
        console.log(error.toString())
    }
}

使用选择

Clipboard_Screenshot_1757045120.png