Skip to content

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.

License

Notifications You must be signed in to change notification settings

lablnet/PHP-Logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 composer require lablnet/logger

usage

<?php 
	use Lablnet\Logger;
	require '../vendor/autoload.php';
	$logger = new Logger;
	// If you want set custom file 
	// prototype: $logger->setFile(filewithpath);
	// $logger->setFile("../my.logs");
	$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])

custom file

For setting your own custom file $logger->setFile("data/app.logs");

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

About

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.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages