展示HN:Timberlogs – TypeScript 的即插即用结构化日志记录

3作者: enaboapps25 天前原帖
嗨,HN!我创建了Timberlogs,因为我厌倦了在生产环境中使用console.log,并且现有的日志解决方案需要过多的设置。 Timberlogs是一个适用于TypeScript的即插即用结构化日志库: ```bash npm install timberlogs-client ``` ```typescript 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); ``` 功能特点: - 自动批处理和重试 - 自动屏蔽敏感数据(密码、令牌) - 全文搜索所有日志 - 实时仪表盘 - 流程追踪以链接相关日志 目前该项目处于测试阶段,免费使用。非常希望得到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 &quot;timberlogs-client&quot;; const timber = createTimberlogs({ source: &quot;my-app&quot;, environment: &quot;production&quot;, apiKey: process.env.TIMBER_API_KEY, }); timber.info(&quot;User signed in&quot;, { userId: &quot;123&quot; }); timber.error(&quot;Payment failed&quot;, 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&#x27;s currently in beta and free to use. Would love feedback from the HN community.<p>Site: <a href="https:&#x2F;&#x2F;timberlogs.dev" rel="nofollow">https:&#x2F;&#x2F;timberlogs.dev</a> Docs: <a href="https:&#x2F;&#x2F;docs.timberlogs.dev" rel="nofollow">https:&#x2F;&#x2F;docs.timberlogs.dev</a> npm: <a href="https:&#x2F;&#x2F;npmjs.com&#x2F;package&#x2F;timberlogs-client" rel="nofollow">https:&#x2F;&#x2F;npmjs.com&#x2F;package&#x2F;timberlogs-client</a> GitHub: <a href="https:&#x2F;&#x2F;github.com&#x2F;enaboapps&#x2F;timberlogs-typescript-sdk" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;enaboapps&#x2F;timberlogs-typescript-sdk</a>