I know, I know, this has been asked before, and I searched on the forums but didn't find much luck. My friend would like a way to reset his time-stamped logfile at midnight or so, and I thought this could be easily done with script and a timer, but when I checked it out the script functions require you to specify a filename for the log, but I want to use the %-substitutions in the world's log filename. Would it automatically swap these out if I just got it from alpha_options, or would I have to do the substitutions manually? It'd be nice if it did it automatically, or maybe if you specified a null string to OpenLog() it would use the preset logfilename making the substitutions. Any help clearing this up?
Daily Log
Posted by Cage_fire_2000 on Fri 10 Aug 2007 04:20 AM — 5 posts, 21,763 views.
Never Mind, after about a half-hour of searching through the forums, I discovered that since 3.51 you were able to supply "" as a filename and use the filename in the options. Which is GREAT! Although maybe in the future it /might/ be nice to have a function to do the substitution so that plugins could use the same file format for making side-logs with FSO.
I have amended the documentation for OpenLog to make that clearer. If you are scripting log file opens you can always build up a filename yourself with things like the date in it.
OK, I think I just either found a bug or another reason to make that substitution function. While CloseLog does write the postamble to the file, OpenLog does not write the Preamble to the new file.
Hmm, the documentation OpenLog for says "nor is a log-file preamble written", so OpenLog is behaving as documented.
The documentation for CloseLog does not say one way or another whether the postamble is written out, and you are right, it does write it - somewhat inconsistently. I have amended the documentation to make it clear that it does this.
I am reluctant to change either one, as people may well be relying on the current behaviour. You can always grab the world's log file preamble (GetInfo (11)) and write it. If it has substitution characters in it then you would need to do a find-and-replace to fix them up.
The documentation for CloseLog does not say one way or another whether the postamble is written out, and you are right, it does write it - somewhat inconsistently. I have amended the documentation to make it clear that it does this.
I am reluctant to change either one, as people may well be relying on the current behaviour. You can always grab the world's log file preamble (GetInfo (11)) and write it. If it has substitution characters in it then you would need to do a find-and-replace to fix them up.