Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log Class #129

Open
abhishekdelta opened this issue May 8, 2012 · 0 comments
Open

Log Class #129

abhishekdelta opened this issue May 8, 2012 · 0 comments

Comments

@abhishekdelta
Copy link
Member

Sometimes debugging can be very difficult. It would be much better if pragyan has a LOG Class that has functions which will be used to log information at every step of what pragyan cms does. The log entries will be stored in a text-file and a new text-file will be automatically created every day/week or month. When a new text-file is created, the previous text-files should be archived into a ZIP file so that too many logs dont take up too much harddisk space. The ZIP file should be named after the duration of logs inside it, for example the day/week/month or year or a combination of them.

As an example, all the displayinfo/warning/errors will be logged. Also all the information as and when its updated in pragyanV3_log table in database should also be logged. Moreover, whenever any of us gets the time to go through the existing codes again, we may want to log all the MySQL errors which we display using die() function. Also extra log entries of what pragyan cms does internally can also be added, not only errors but also successful steps should be logged. Also if its possible to somehow pipe the PHP Warnings/ Notices and Errors one may get to see when config.inc.php errorlevel is set to 4, to the log file then it would greatly serve the purpose.

The log format should be
[TIME][DATE] : [FILENAME] : [LINENUMBER] : [ERRORTYPE] : [LOGINFO]

where TIME,DATE are as usual, FILENAME is the PHP file name where that log entry was generated, LINENUMBER is the line number in that file (it may not be possible to always get the LineNumber, put it only if you're able to find it), ERRORTYPE is the log type (error/warning/information), LOGINFO is the actual log entry.

The log class should have method that can be easily callable, something like

LOG::loginfo("quiz module creation done"). And similarly, LOG::logerror/logwarning, etc. NOTE that all functions are STATIC meaning user should not have to create an instance of LOG class to use its functions or other parameters. This is obvious because there will be a global LOG class for the entire CMS spanning all the files.

Also some ways should be found to detect the filename and linenumber without having the user to type it. However, if its really impossible to do that, the functions can be modified to look like this :

LOG::loginfo("cms/modules/quiz.lib.php","L:245","quiz module creation done")

But try hard to avoid it.

Note that this logging will be different that the existing log table in database. The existing log table only logs user actions, not pragyan cms internal activities.

@ghost ghost assigned abhishekdelta May 8, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant