PHP Classes

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

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
Not yet rated by the usersTotal: 25 All time: 11,214 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: 32063 in Ghana Ghana
Week rank: 46 Up1 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 (3)  
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

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  
 100%
Total:25
This week:0
All time:11,214
This week:571Up