you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 1 fun -  (3 children)

What I'm asking is why is this not 2 lines?

If filesize(logfile) >= arbitrary_amount
Rename(logfile, current_date + ".log")

It's been a long time since I've done this shit, maybe I'm missing something you're doing

[–]fschmidt[S] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 1 fun -  (2 children)

The only reason for more code is to allow multiple rolling backup files. Here is the code, it is quite simple.

[–][deleted] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 1 fun -  (1 child)

I just didn't get why anything was moved, but x0 said it had to do with file descriptor staying open. That makes sense.

[–]fschmidt[S] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 1 fun -  (0 children)

That only makes sense if this is done by an outside process. Since I am doing it in code in the same process, I just close the file descriptor, move the file, and open a new file descriptor. So none of the issues mentioned by x0x7 apply.