[译]实时日志文件查看器
By robot-v1.0
本文链接 https://www.kyfws.com/applications/a-real-time-log-file-viewer-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 3 分钟阅读 - 1401 个词 阅读量 0[译]实时日志文件查看器
原文地址:https://www.codeproject.com/Articles/7081/A-real-time-log-file-viewer
原文作者:amleth
译文由本站 robot-v1.0 翻译
前言
A real time log file viewer.
实时日志文件查看器.
- 下载ABLogFile.exe-27.5 Kb(Download ABLogFile.exe - 27.5 Kb) (需要MFC)((Requires MFC))
- 下载源-69.2 Kb(Download source - 69.2 Kb)
介绍(Introduction)
**ABLogFile(ABLogFile)**是一个非常简单易用的实时日志文件查看器.所需要做的只是打开一个基于文本的日志文件,该程序将检查文件的任何更改并自动在屏幕上显示它们.新更改以明亮的颜色显示,然后淡出为正常的文本颜色.它还会自动滚动到最新行.(is a very simple and easy to use real time log file viewer. All that is required is to open a text based log file, this program will check for any changes to the file and automatically display them on the screen. The new changes are displayed in a bright color and then fade to the normal text color. It also automatically scrolls to the newest line.)**ABLogFile(ABLogFile)**支持非常基本的查找功能.(supports a very basic find function.)
背景(Background)
几个星期前的深夜,人们才想到了这个程序.我正在做一些工作,该程序每两秒钟更新一次文件.我的问题是,如果我想查看更改,则必须继续重新打开文件,因此(This program was thought up in the early hours of the night a couple of weeks ago. I was doing some work, a program that updated a file every couple of seconds. My problem was, if I wanted to see the changes, I had to keep reopening the file, thus)**ABLogFile(ABLogFile)**被想到.(was thought of.)
兴趣点(Points of Interest)
该项目最困难的部分是如何组织内存中的数据,以便轻松添加新数据,跟踪更改并快速显示数据.经过数次不眠之夜的编码后,我最终要做的是将整个日志文件存储在内存中,创建了一个指向每行开始位置的指针数组,以及另一个跟踪更改的部分数组到日志文件.另一个棘手的问题是弄清楚文件中的行定界符是什么,我最终编写它的方式是搜索许多不同的定界符,这部分肯定会很快进行重新设计.除了上面提到的以外,它还很简单.(The hardest part of the project was how to organize the data in memory, so that it is easy to add new data, keep track of the changes, and quick to display the data. What I ended up doing after a number of sleepless nights of coding, was to store the entire log file in memory, create an array of pointers that point to the starting position of each line, and another array of sections which keep track of the changes to the log file. Another tricky bit was to work out what the line delimiter was in the file, the way that I ended up writing it was to search for a number of different delimiters, this part will definitely be redesigned shortly. Apart from the above mentioned, it was pretty straight forward.)
局限性(Limitations)
当然,有一些限制:(Of course, there are some limitations:)
- 日志文件当前存储在内存中,因此查看非常大的文件可能会出现问题.(The log file is currently stored in memory, therefore there may be a problem viewing very large files.)
- 使用自动定界符的方式,如果第二行为空白,则文件将无法正确显示.(With the way that the auto delimiter works, if the second line is blank then the file will not be displayed properly.)
- 该程序仅跟踪新添加到文件中的数据,不适用于文件中更改的数据.(This program will only keep track of data newly appended to the file, it will not work with data getting changed in the file.)
致谢(Acknowledgements)
- 选项卡式MDI视图版权所有©Dundas Software.(Tabbed MDI view Copyright © by Dundas Software.)
历史(History)
我相信这个项目将带来巨大的好处,我将愿意按照人们的建议添加功能.该程序当前可以执行我本来需要执行的操作.因此,请让我知道所需的任何功能.(I believe this project to be of great benefit, I will be willing to add features as people suggest them. This program currently does what was originally required by myself. So, please let me know of any features required.)
-
**V 1.0.0.1(V 1.0.0.1)**2004-05-13(2004-05-13)
- 二进制和源代码的首次公开发行.(First public release of binary and source code.)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C++ VC7.0 WinXP Windows Win2K MFC Visual-Studio Dev 新闻 翻译