dev-master
9999999-dev https://github.com/DevinClark/Console-PHPConsole Logging for PHP
The Requires
- php >=5.3.0
by Devin Clark
log logging console
Wallogit.com
2017 © Pedro Peláez
Console Logging for PHP
A project by Devin Clark, (*1)
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)
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)
->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.echo $test->print_errors();
Alternatively, you can do echo (string)$test; and get the same result. It's up to you., (*6)
Console Logging for PHP
log logging console