It's unclear what curLogs is supposed to represent. If I'm reading it correctly, its the number of current logs.
Why is this necessary when creating a file? Is a log different from a file?