|
-
Jan 25th, 2013, 09:26 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Universal StreamWriter logging updating file in real time
I have created a Logging class which inside hosts 4 static methods of writing to a text file: BeginLog, Log, EndLog, and SendLog. Right now these all use the same class level defined StreamWriter variable. I initially did this so I wouldn't have to constantly create new ones and keep checking if ones are open/closed/etc... However, I noticed that changes won't be saved in the text file until the StreamWriter is closed/disposed.
I tried wrapping each one in a using block, but kept getting constant errors because so many places call writing to the log that it eventually tries writing to a closed stream...
Any ideas on how the best implementation for this would be, so that the log basically gets 'saved' after each write without worrying about how many writes are occuring.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|