Skip to content

A simple library for logging PHP events to a file, STDERR stream, or both!

Notifications You must be signed in to change notification settings

CixoDevelop/CxLogger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

CxLogger

Custom logging system for PHP

How to install it?

You need to copy CxLogger.php to your project's library directory, or if you prefer to include_path, then include it with require_once ("path / to / CxLogger.php")

How using it?

Creating logger

  • $logger = new CxLogger(); - The simplest logger, it only logs to STDERR
  • $logger = new CxLogger("path/to/log.log"); - Logs to both STDERR and file
  • $logger = new CxLogger("path/to/log.log", false); - Messages with the info level are logged to the file, and those with a level higher to the file and STDERR
  • $logger = new CxLogger("path/to/log.log", false, false); - Logs to file only

Logging

$logger->log($level, $message_part_one, $message_part_two, ...);

$level

  • Level:info - zero level, info message
  • Level:warning - fisrt level
  • Level:standard_error - runtime error
  • Level:critical_error - critical app error

$message_part_*

  • messages with string or int or etc

Examples

  • $logger->log(Level:info, "Create users:", 33);
  • $logger->log(Level:warning, "You are awesome!");

About

A simple library for logging PHP events to a file, STDERR stream, or both!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages