保持日志文件打开与每次打开它
我编写了一个类来输出有关我的程序的日志信息。例如,我初始化 OpenGL,然后写入日志。我见过的旧日志示例每次想要输出错误或成功时都会打开文件。由于我正在编写一个密集型图形程序,因此始终打开文件、写入文件并在程序结束时关闭它会有什么缺点?
有一个权衡吗?
谢谢!
I wrote up a class to output logging information about my program. For instance, I initialize OpenGL and then write to the log. The old log example I have seen opens the file every single time it wants to output an error or success. Since I am writing an intensive graphics program, what would be the drawback of having the file open the entire time, writing to it and closing it when the program ends?
Is there a tradeoff?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么要关心自己写入日志文件?只需使用标准日志框架,例如 log4x 系列
Why be concerned with writing to a logfile yourself? Just use a standard logging framework like the log4x series