PHP Classes

PHP Log Writer: Write log messages to files in CSV or JSON formats

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 25 All time: 11,114 This week: 571Up
Version License PHP version Categories
php-log-writer 1.0The PHP License5PHP 5, Logging
Description 

Author

This class can write log messages to files in CSV or JSON formats.

It can take a variable value and it converts it to a string encoding it in the CSV or JSON formats or using PHP print_r function before it appends the converted string to a file.

The log file is written to a specific file in a given directory. The file name has perfix and the current date as suffix.

Picture of Hillary Kollan
  Performance   Level  
Name: Hillary Kollan <contact>
Classes: 10 packages by
Country: Ghana Ghana
Age: ???
All time rank: 32133 in Ghana Ghana
Week rank: 109 Up2 in Ghana Ghana Up
Innovation award
Innovation award
Nominee: 5x

Example

<?php
include('LaravelLog.php');
$log = (new LaravelLog);
   
//set path
   
$log->setPath(getcwd());

   
//set filename
   
$log->setFileName('requests');

   
//log arrays, objects, integers or strings in either .log, .json and .csv file formats by setting the extension in the second argument
   
$log->logData((object) $_SERVER, 'json');


Details

"# PHP-Log-Writer"

Usage

Include class

    include('LaravelLog.php');

Set file name

    $log->setFileName('requests');

Log arrays, objects, integers or strings in either .log, .json and .csv file formats by setting the extension in the second argument

    $log->logData((object) $_SERVER, 'json');


  Files folder image Files  
File Role Description
Plain text file LaravelLog.php Class Class source
Accessible without login Plain text file logit.php Example Example script
Accessible without login Plain text file readme.md Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 100%
Total:25
This week:0
All time:11,114
This week:571Up