Downloads

TCL – Tiny Circle Log

This is a tiny log script that lets you log stuff in kind of a circle database thingy. What´s the benefit of this? Well lets say that you want to log something in a textfile, for exemple a value of some kind, for each visitor on your page. But only ”up-to-date” information is relevant to you. Then it would be uneccessary to just add data into the same file (especially if you forget to clear the file once in a while), so the file can just grow and grow and grow. What this script does is that it creates a new textfile for each given period, and when the period ends and starts over, the old files will be cleared and rewritten one by one .

Example:

Given period is one week, 7 days. On monday a file is created called ”1.log”, now all the log data will be stored in that file on that day. The next day, tuseday, a new file will be created called ”2.log”, now all log data for this day will be stored in that file and so on  (you get the point?). So this keeps happening for each day until its monday again, then we will have seven log files (one for each day) and the process will start all over again, but it will start of with reseting the file for the current day. So after a week when it´s monday again the ”1.log” will be reset before new log data is added.

Smart hu?

Click here to download tcl.php

Kommentera

Fyll i dina uppgifter nedan eller klicka på en ikon för att logga in:

WordPress.com Logo

Du kommenterar med ditt WordPress.com-konto. Logga ut / Ändra )

Twitter-bild

Du kommenterar med ditt Twitter-konto. Logga ut / Ändra )

Facebook-foto

Du kommenterar med ditt Facebook-konto. Logga ut / Ändra )

Google+ photo

Du kommenterar med ditt Google+-konto. Logga ut / Ändra )

Ansluter till %s