PHP code example of lyhiving / debug

1. Go to this page and download the library: Download lyhiving/debug library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lyhiving / debug example snippets



use lyhiving\debug\debug;

$debug = new debug(__DIR__."/debug.txt");



use lyhiving\debug\debug;

$debug = new debug(__DIR__.'/debug.txt');
$_GET['im'] = 'debug';
$_GET['array'] = array('apple','orange','bananer');

$_POST['im'] = 'a POST data';
$_POST['array'] = array('apple','orange','bananer');

$debug->log('MAC','MAKE A BETTER WORLD');
$debug->log('TIME','@time');



use lyhiving\debug\debug;
define('IA_ROOT', dirname(__DIR__));

$debug = new debug();
$debug->dump('MAKE A BETTER WORLD');
$debug->_dump('OK. I\'m the last line.');



use lyhiving\debug\debug;


$debug = new debug();
$debug->file(__DIR__.'/new.txt')->dump('MAKE A BETTER WORLD');
$debug->_dump('OK. I\'m the last line.');

//简单模式,需额外设置
$debug->set('log_level',0);
//默认为1,也可以随时设置回来
$debug->set('log_level',1);
//接管错误
$debug->set('catch_error',1);
//接管异常
$debug->set('catch_exception',1);

//开启记录毫秒时间,并且记录同时输出相同内容
$debug->set('log_microtime', true)->set('log_and_echo', true);
//开启记录毫秒时间,并且记录详细信息,输出时去掉所在行和执行时间,更接近console_info
$debug->set('log_microtime', true)->set('log_and_echo', 'timed');



use lyhiving\debug\debug;
define('IA_ROOT', dirname(__DIR__));

$debug = new debug(__DIR__."/#debug.txt");
$debug->log('MAC', 'MAKE A BETTER WORLD');
$debug->log('ArrayNormal', array('apple', 'orange', 'banner'));
//Set less log info
$debug->set('log_level',0);
//If you want less infomation
$debug->log('ArrayCanCopyDirect', array('apple', 'orange', 'banner'));
$debug->dump('MAKE A BETTER WORLD');
$debug->_dump('OK. I\'m the last line.');