PHP Classes

XLog: Write log messages to PHP or INI files

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 50%Total: 417 All time: 6,429 This week: 571Up
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

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 (2)  
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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:417
This week:0
All time:6,429
This week:571Up
User Ratings User Comments (1)
 All time
Utility:75%StarStarStarStar
Consistency:62%StarStarStarStar
Documentation:-
Examples:68%StarStarStarStar
Tests:-
Videos:-
Overall:50%StarStarStar
Rank:2683
 
This is a very good and useful class .
16 years ago (José Filipe Lopes Santos)
70%StarStarStarStar