2017 © Pedro Peláez
 

library console-php

Console Logging for PHP

image

devin-clark/console-php

Console Logging for PHP

  • Monday, August 19, 2013
  • by DevinClark
  • Repository
  • 1 Watchers
  • 1 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Console.PHP

A project by Devin Clark, (*1)

Installation

Using Composer:, (*2)

{
    "require": {
      "devin-clark/console-php": "dev-master"
    }
}

Otherwise, just download the class and drop it in somewhere and require it. Pretty simple., (*3)

Example

A super minimal example to get started:, (*4)

require("Console-PHP.php");  
$errors = new Console_PHP;
$errors->log("This message won't output")->print_errors();

As you can see, you can also chain methods to your hearts content.
You probably are familiar with Chrome DevTools but if not, you can read up on it here. Console API Reference, (*5)

Available Methods

  • ->log($message) - Logs a message to the console.
  • ->clear() - Clears the console.
  • ->dir($obj) - Displays an object in a pretty way.
  • ->group("Name") - Creates a group.
  • ->groupCollapsed("Name") - Creates a collapsed group.
  • ->groupEnd() - Ends the group.
  • ->warn($message) - Logs a warning to the console.
  • ->count("Message"); - Shows how many times count is invoked for a specific label.
  • ->assert($condition, "Description") - The first parameter is a condition and if that condition evaluates to false, the assertion fails and a message will be outputted to the console.

Output Errors

echo $test->print_errors();

Alternatively, you can do echo (string)$test; and get the same result. It's up to you., (*6)

The Versions

19/08 2013

dev-master

9999999-dev https://github.com/DevinClark/Console-PHP

Console Logging for PHP

  Sources   Download

The Requires

  • php >=5.3.0

 

log logging console