Show HN: Timberlogs – 适用于 TypeScript 的即插即用型结构化日志记录
3 分•作者: enaboapps•6 个月前
大家好,我是 Timberlogs 的开发者!我构建 Timberlogs 是因为我厌倦了在生产环境中用 console.log 调试,也觉得现有的日志解决方案设置起来太麻烦了。
Timberlogs 是一个即插即用的 TypeScript 结构化日志库:
```
npm install timberlogs-client
import { createTimberlogs } from "timberlogs-client";
const timber = createTimberlogs({
source: "my-app",
environment: "production",
apiKey: process.env.TIMBER_API_KEY,
});
timber.info("用户已登录", { userId: "123" });
timber.error("支付失败", error);
```
功能:
* 自动批处理和重试
* 自动编辑敏感数据(密码、令牌)
* 全文搜索所有日志
* 实时仪表盘
* 流程追踪,关联相关日志
目前处于 Beta 测试阶段,免费使用。欢迎 HN 社区提供反馈。
网站:[https://timberlogs.dev](https://timberlogs.dev)
文档:[https://docs.timberlogs.dev](https://docs.timberlogs.dev)
npm:[https://npmjs.com/package/timberlogs-client](https://npmjs.com/package/timberlogs-client)
GitHub:[https://github.com/enaboapps/timberlogs-typescript-sdk](https://github.com/enaboapps/timberlogs-typescript-sdk)
查看原文
Hi HN! I built Timberlogs because I was tired of console.log in production and existing logging solutions requiring too much setup.<p>Timberlogs is a drop-in structured logging library for TypeScript:<p><pre><code> npm install timberlogs-client
import { createTimberlogs } from "timberlogs-client";
const timber = createTimberlogs({
source: "my-app",
environment: "production",
apiKey: process.env.TIMBER_API_KEY,
});
timber.info("User signed in", { userId: "123" });
timber.error("Payment failed", error);
</code></pre>
Features:
- Auto-batching with retries
- Automatic redaction of sensitive data (passwords, tokens)
- Full-text search across all your logs
- Real-time dashboard
- Flow tracking to link related logs<p>It's currently in beta and free to use. Would love feedback from the HN community.<p>Site: <a href="https://timberlogs.dev" rel="nofollow">https://timberlogs.dev</a>
Docs: <a href="https://docs.timberlogs.dev" rel="nofollow">https://docs.timberlogs.dev</a>
npm: <a href="https://npmjs.com/package/timberlogs-client" rel="nofollow">https://npmjs.com/package/timberlogs-client</a>
GitHub: <a href="https://github.com/enaboapps/timberlogs-typescript-sdk" rel="nofollow">https://github.com/enaboapps/timberlogs-typescript-sdk</a>