PHP Classes
elePHPant
Icontem

Logger class oLogger: Generate and process logs files in XML format

Recommend this page to a friend!
  Info   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2006-04-20 (10 years ago) RSS 2.0 feedNot enough user ratingsTotal: 742 All time: 4,311 This week: 1,068Up
Version License Categories
ologger 1.0Free for non-comm...XML, PHP 5, Logging
Description Author

This class can be used to generate and process log files stored in XML format.

The class can add new log entries defined by XML nodes using values defined in an array class variable.

The class can also parse a log file and display the log entries.

Picture of Johan Barbier
Name: Johan Barbier <contact>
Classes: 17 packages by
Country: France France
Innovation award
Innovation award
Nominee: 6x

Details
FRENCH

Ceci est une classe de log.
La classe en elle-même se trouve dans le répertoire class/class.oLogger.php

Les 2 fichiers log.consult.php et log.detail.php sont là pour un exemple d'utilisation.
Je les ai extirpé de ma propre interface...donc c'est du bidouillage pour que ça tourne en local lol :-) A vous de bidouiller la css fournie.
Mais vous avez déjà une bonne base quand même, un bon exemple d'utilisation des logs créés.

Les logs sont déjà créés évidemment.

Pour créer les logs, personnellement, je les ai mis dans ma classe DB, dans la méthode effectuant une requête (oDB::query). Je ne logge pas les SELECT, mais ça, c'est un choix :-)
Donc, je lance mon log ainsi :

if (true === $log && substr (strtoupper (trim ($this->s_db_sql)), 0, 6) !== 'SELECT') {
	$ologger = new oLogger;
	$destId = (isset ($_SESSION['dest_id']))?$_SESSION['dest_id']:0;
	$ologger -> init ($this -> s_db_sql, $destId);
}

C'est tout! C'est ce petit bout de code qui a généré les quelques logs que je montre ici.


ENGLISH

This is a log class.
The class in itself is in the folder 'class/class.oLogger.php'

The 2 files log.consult.php and log.detail.php are here to show an exemple of how to handle these logs.
I took them from my own UI, so...I just did what needed to be done for theml to work locally.
You can (and should) modify them for your use! 
But this is a good ground I think.

The logs are already created, of course...
But, to create them, here is what I did : 
I put this code in my database class oDB, in its query method (like mysql_query...).
I do not log the SELECT queries, but that's a choice. So, my code is juste this one :

if (true === $log && substr (strtoupper (trim ($this->s_db_sql)), 0, 6) !== 'SELECT') {
	$ologger = new oLogger;
	$destId = (isset ($_SESSION['dest_id']))?$_SESSION['dest_id']:0;
	$ologger -> init ($this -> s_db_sql, $destId);
}

Thaty's all! It's enough to create the needed logs through the whole application.
Oh : $_SESSION['dest_id'] contains the current user id. Just replace it by YOUR way to store your user's id.
  Files folder image Files  
File Role Description
Files folder imageclass (1 file)
Files folder imagecss (1 file)
Files folder imagelogs (2 directories)
Accessible without login Plain text file log.consult.php Example Exemple
Accessible without login Plain text file log.detail.php Example Example
Accessible without login Plain text file readme.txt Doc. documentation

  Files folder image Files  /  class  
File Role Description
  Plain text file class.oLogger.php Class Logger class

  Files folder image Files  /  css  
File Role Description
  Accessible without login Plain text file main.css Data css file

  Files folder image Files  /  logs  
File Role Description
Files folder image3026 (1 file)
Files folder image6 (1 file)

  Files folder image Files  /  logs  /  3026  
File Role Description
  Accessible without login Plain text file 20060420.xml Output log file

  Files folder image Files  /  logs  /  6  
File Role Description
  Accessible without login Plain text file 20060420.xml Output log file

 Version Control Unique User Downloads Download Rankings  
 0%
Total:742
This week:0
All time:4,311
This week:1,068Up