PHP Classes

PHP Logger class: Log messages with different levels of severity

Recommend this page to a friend!
  Info   View files Example   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 182 All time: 8,693 This week: 571Up
Version License PHP version Categories
php-logger-class 1.0.0MIT/X Consortium ...5PHP 5, Logging
Description 

Author

This package can log messages with different levels of priority.

It can take a string as parameters with the message to log and append it to a log file according to a given severity level.

The package supports several levels of severity like emergency, alert, critical, error, warning, notice, info and debug.

Picture of Muhammad Umer Farooq
Name: Muhammad Umer Farooq is available for providing paid consulting. Contact Muhammad Umer Farooq .
Classes: 52 packages by
Country: Pakistan Pakistan
Age: 22
All time rank: 84511 in Pakistan Pakistan
Week rank: 93 Up2 in Pakistan Pakistan Up
Innovation award
Innovation award
Nominee: 6x

Example

<?php
   
use Lablnet\Logger;
    require
'../vendor/autoload.php';
   
$logger = new Logger;
   
$logger->debug("Hi im log msg and im {field}" , ['field' => 'debug']);
   
var_dump($logger->get());


Details

PHP Logger

Logging is one of the most ubiquitous tasks encountered in PHP. We use logs to track error messages, record important events, and debug problems with our code this class exectly do this.

Requirement

  • PHP
  • Composer

install

run this command


## usage

<?php

use Lablnet\Logger;
require '../vendor/autoload.php';
$logger = new Logger;
$logger->debug("Hi im log msg and im {field}" , ['field' => 'debug']);
var_dump($logger->get());

## Levels
- emergency => ```$logger->emergency(msg,[context])```
- alert => ```$logger->alert(msg,[context])```
- critical => ```$logger->emergency(msg,[critical])```
- error => ```$logger->error(msg,[context])```
- warning => ```$logger->warning(msg,[context])```
- notice => ```$logger->notice(msg,[context])```
- info => ```$logger->info(msg,[context])```
- debug => ```$logger->debug(msg,[context])```

# Note: .logs file will save in root of project directory 

  Files folder image Files  
File Role Description
Files folder imageexample (1 file)
Files folder imagesrc (3 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file readme.md Doc. Read me first

  Files folder image Files  /  example  
File Role Description
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files  /  src  
File Role Description
  Plain text file AbstractLogger.php Class Class source
  Plain text file Logger.php Class Class source
  Plain text file LogLevel.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:182
This week:0
All time:8,693
This week:571Up