Re: Design question...
- From: "Nick Z." <pacemkr@xxxxxxxxx>
- Date: Mon, 26 Sep 2005 21:16:12 -0400
Michael C wrote:
"Nick Z." <pacemkr@xxxxxxxxx> wrote in message news:OO0_e.103$Ge5.70@xxxxxxxxxxx
I am writing a reusable class for logging.
My goal is to make it as fast and as robust as possible, while keeping memory usage to the lowest. All members are static.
For some reason I'm stuck on the following design question.
Obviously you need a stream to write the log file.
Should this stream be created every time the log needs to be written, or should the stream be a member variable of the logging class and only be opened and closed once per application lifetime.
Can someone suggest the right way to go here and why?
This seems like a simple question but for some reason I can't decide which is the right way to do this. Does it even matter?
For logs I open and close the stream each time. If someone happens to terminate the app premeturely you need to be able to see the log.
Michael
Hmmm, true. But what if you force the stream to flush after each write.
I guess I want to know what the overhead is for creating the stream every time.
.
- Follow-Ups:
- Re: Design question...
- From: jeremiah johnson
- Re: Design question...
- References:
- Design question...
- From: Nick Z.
- Re: Design question...
- From: Michael C
- Design question...
- Prev by Date: Re: Design question...
- Next by Date: Re: Design question...
- Previous by thread: Re: Design question...
- Next by thread: Re: Design question...
- Index(es):
Relevant Pages
|