TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Normalizing logs between components

2 点作者 hndl超过 8 年前
This is a software design question: I have different components which do similar operations (similar, not identical) and I want to normalize the logs that each component emits so I can make diagnosing issues easier. What approach should I take?<p>One thing I have thought about is using an error code for a specific known fault and then emit a message based on the error code (think M$ error codes) - same message parameters for all components but the values differ.<p>I&#x27;m more interested in hearing how this has been addressed by HNers who have had to build this functionality in the wild. If there are references, please share.

1 comment

brudgers超过 8 年前
My random advice from the internet.<p>Prototype at the level of text output at the shell level bash&#x2F;sed&#x2F;gawk&#x2F;grep because:<p>1. It may turn out that that&#x27;s all that&#x27;s needed.<p>2. Making changes in one place is easier.<p>3. It is more flexible when trying to figure out what should be done.<p>4. It will not introduce a bug into the existing code.<p>5. It will not create a dependency between the components.<p>6. The shell is the appropriate level of abstraction for logs.<p>This might be a good question for Software Engineering on StackExchange.<p>Good luck.