PHP Classes

XLog: Write log messages to PHP or INI files

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 50%Total: 416 All time: 6,420 This week: 378Up
Version License PHP version Categories
xlog 1.0MIT/X Consortium ...5Logging
Description 

Author

This class can be used to write log messages to PHP or INI files.

It can write details about events to log files that may include details such as event file, event line, event time and date, current page URL and remote user IP address.

The class can write to log files in either plain text format, INI format or a PHP file that wraps the log messages in comments.

Picture of Costin Trifan
Name: Costin Trifan <contact>
Classes: 5 packages by
Country: Romania Romania
Age: 45
All time rank: 64712 in Romania Romania
Week rank: 312 Up3 in Romania Romania Up

Example

<?php
include "class.XLog.php";

$log = new XLog();

# SET THE PATH TO THE LOG FILE
$log_file_php = $_SERVER['DOCUMENT_ROOT'].'/xlog/logs/log.php';

# The message
$msg_php = "<strong>A log entry into a php file</strong>";

# Log messages in a php file
$log->Write($msg_php, __FILE__, __LINE__, FALSE, $log_file_php);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Using the XLog class</title>
</head>
<body>

<h4 style="font-weight: normal;">The content of the log file <strong><?php echo $log_file_php;?></strong> is displayed below:</h4>

<p>The size of the log file is: <strong><?php echo $log->GetFileSize($log_file_php);?></strong></p>

<div style="margin: 25px; border: solid 1px #ccc; padding: 5px;">
    <pre><?php echo $log->GetContent($log_file_php);?></pre>
</div>

</body>
</html>


  Files folder image Files  
File Role Description
Accessible without login Plain text file class.XLog.php Class The class's source
Accessible without login Plain text file test.php Example Test file

 Version Control Unique User Downloads Download Rankings  
 0%
Total:416
This week:0
All time:6,420
This week:378Up
User Ratings User Comments (1)
 All time
Utility:75%StarStarStarStar
Consistency:62%StarStarStarStar
Documentation:-
Examples:68%StarStarStarStar
Tests:-
Videos:-
Overall:50%StarStarStar
Rank:2606
 
This is a very good and useful class .
14 years ago (José Filipe Lopes Santos)
70%StarStarStarStar