-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from nguyenanhung/v4.x
V4.x
- Loading branch information
Showing
10 changed files
with
90 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
defined('BASE_DEV_IDE') or exit('No direct script access allowed'); | ||
if (!function_exists('log_message')) { | ||
function log_message($name, $message): void | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,105 +30,106 @@ Tham khảo hướng dẫn triển khai tại đây và trong thư mục `test/` | |
```php | ||
<?php | ||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
require_once __DIR__ . '/functions.php'; | ||
require __DIR__ . '/func.php'; | ||
|
||
use nguyenanhung\MyDebug\Logger; | ||
|
||
// Test Content | ||
$logPath = __DIR__.'/tmp'; | ||
$logSubPath = 'tests-debug-2'; | ||
$logPath = __DIR__ . '/../tmp'; | ||
$logPath = realpath($logPath); | ||
$logSubPath = date('Y-m-d'); | ||
$logFilename = 'Log-' . date('Y-m-d') . '.log'; | ||
$name = 'Test'; | ||
$msg = 'Test Log lan 2'; | ||
$context = [ | ||
'name' => 'Nguyen An Hung', | ||
'email' => '[email protected]' | ||
$name = 'Test'; | ||
$msg = 'Test Log lan 2'; | ||
$context = [ | ||
'name' => 'Nguyen An Hung', | ||
'email' => '[email protected]', | ||
'website' => 'https://nguyenanhung.com', | ||
]; | ||
// Call | ||
$debug = new Logger(); | ||
$debug->setDebugStatus(TRUE); | ||
$debug->setGlobalLoggerLevel('info'); | ||
$debug->setLoggerPath($logPath); | ||
$debug->setLoggerSubPath($logSubPath); | ||
$debug->setLoggerFilename($logFilename); | ||
$debug->__construct(); | ||
$logger = new Logger(); | ||
$logger->setDebugStatus(true); | ||
$logger->setGlobalLoggerLevel(); | ||
$logger->setLoggerPath($logPath); | ||
$logger->setLoggerSubPath($logSubPath); | ||
$logger->setLoggerFilename($logFilename); | ||
$logger->__construct(); | ||
echo "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; | ||
echo "\n getVersion: " . $debug->getVersion() . "\n"; | ||
echo "\n setDebugStatus: " . $debug->getDebugStatus() . "\n"; | ||
echo "\n setLoggerPath: " . $debug->getLoggerPath() . "\n"; | ||
echo "\n setLoggerSubPath: " . $debug->getLoggerSubPath() . "\n"; | ||
echo "\n setLoggerFilename: " . $debug->getLoggerFilename() . "\n"; | ||
echo "\n getVersion: " . $logger->getVersion() . "\n"; | ||
echo "\n setDebugStatus: " . $logger->getDebugStatus() . "\n"; | ||
echo "\n setLoggerPath: " . $logger->getLoggerPath() . "\n"; | ||
echo "\n setLoggerSubPath: " . $logger->getLoggerSubPath() . "\n"; | ||
echo "\n setLoggerFilename: " . $logger->getLoggerFilename() . "\n"; | ||
echo "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; | ||
|
||
d($debug->debug($name, $msg . ' - DEBUG', $context)); | ||
d($debug->info($name, $msg . ' - INFO', $context)); | ||
d($debug->notice($name, $msg . ' - NOTICE', $context)); | ||
d($debug->warning($name, $msg . ' - WARNING', $context)); | ||
d($debug->error($name, $msg . ' - ERROR', $context)); | ||
d($debug->critical($name, $msg . ' - CRITICAL', $context)); | ||
d($debug->alert($name, $msg . ' - ALERT', $context)); | ||
d($debug->emergency($name, $msg . ' - EMERGENCY', $context)); | ||
__show__($logger->debug($name, $msg . ' - DEBUG', $context)); | ||
__show__($logger->info($name, $msg . ' - INFO', $context)); | ||
__show__($logger->notice($name, $msg . ' - NOTICE', $context)); | ||
__show__($logger->warning($name, $msg . ' - WARNING', $context)); | ||
__show__($logger->error($name, $msg . ' - ERROR', $context)); | ||
__show__($logger->critical($name, $msg . ' - CRITICAL', $context)); | ||
__show__($logger->alert($name, $msg . ' - ALERT', $context)); | ||
__show__($logger->emergency($name, $msg . ' - EMERGENCY', $context)); | ||
``` | ||
|
||
### Benchmark | ||
|
||
```php | ||
<?php | ||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
require_once __DIR__ . '/functions.php'; | ||
require __DIR__ . '/func.php'; | ||
|
||
use nguyenanhung\MyDebug\Benchmark; | ||
|
||
$benchmark = new Benchmark(); | ||
/***************************** SIMPLE BENCHMARKING BY CI *****************************/ | ||
$benchmark->mark('code_start'); | ||
$mathFunctions = array("abs", "acos", "asin", "atan", "floor", "exp", "sin", "tan", "pi", "is_finite", "is_nan", "sqrt"); | ||
$count = 9999; | ||
$mathFunctions = ["abs", "acos", "asin", "atan", "floor"]; | ||
$count = 10; | ||
for ($i = 0; $i < $count; $i++) { | ||
foreach ($mathFunctions as $key => $function) { | ||
$function($i); | ||
echo ($key + 1) . " -> " . $function . "\n"; | ||
} | ||
foreach ($mathFunctions as $key => $function) { | ||
$function($i); | ||
echo ($key + 1) . " -> " . $function . "\n"; | ||
} | ||
} | ||
$benchmark->mark('code_end'); | ||
|
||
|
||
d($benchmark->elapsed_time('code_start', 'code_end')); | ||
d($benchmark->memory_usage()); | ||
/***************************** SIMPLE BENCHMARKING BY CI *****************************/ | ||
__show__($benchmark->elapsed_time('code_start', 'code_end')); | ||
__show__($benchmark->memory_usage()); | ||
``` | ||
|
||
### Manage File | ||
|
||
```php | ||
<?php | ||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
require_once __DIR__ . '/functions.php'; | ||
require __DIR__ . '/func.php'; | ||
|
||
use nguyenanhung\MyDebug\Manager\File; | ||
|
||
$file = new File(); | ||
$file->setExclude(['*.zip']); | ||
$file->setInclude(['*.log']); | ||
d($file->getVersion()); | ||
d($file->cleanLog(__DIR__.'/tmp', 7)); | ||
$file->setExclude(array('*.zip')); | ||
$file->setInclude(array('*.log')); | ||
|
||
$path = __DIR__ . '/../tmp'; | ||
$path = realpath($path); | ||
|
||
__show__($file->directoryScanner($path)); | ||
``` | ||
|
||
### Utils | ||
|
||
```php | ||
<?php | ||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
require_once __DIR__ . '/functions.php'; | ||
require __DIR__ . '/func.php'; | ||
|
||
use nguyenanhung\MyDebug\Utils; | ||
|
||
$utils = new Utils(); | ||
$str = 'Nguyễn An Hưng'; | ||
|
||
d($utils->getVersion()); // show "2.0.5" | ||
d($utils::slugify($str)); // show "nguyen-an-hung" | ||
$str = 'Nguyễn An Hưng'; | ||
|
||
__show__($utils->getVersion()); | ||
__show__($utils::slugify($str)); | ||
``` | ||
|
||
## Support | ||
|
@@ -139,4 +140,4 @@ If any question & request, please contact following information | |
|-------------|----------------------|------------------|---------------| | ||
| Hung Nguyen | [email protected] | nguyenanhung5891 | @nguyenanhung | | ||
|
||
From Vietnam with Love <3 | ||
From Vietnam with Love <3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,4 @@ | ||
<?php | ||
/** | ||
* Project my-debug | ||
* Created by PhpStorm | ||
* User: 713uk13m <[email protected]> | ||
* Copyright: 713uk13m <[email protected]> | ||
* Date: 14/01/2023 | ||
* Time: 01:29 | ||
*/ | ||
if (!function_exists('__show__')) { | ||
function __show__($s): void | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,18 +2,9 @@ | |
require_once __DIR__ . '/../vendor/autoload.php'; | ||
require __DIR__ . '/func.php'; | ||
|
||
/** | ||
* Project vn-telco-detect. | ||
* Created by PhpStorm. | ||
* User: 713uk13m <[email protected]> | ||
* Date: 9/18/18 | ||
* Time: 17:30 | ||
*/ | ||
|
||
use nguyenanhung\MyDebug\Benchmark; | ||
|
||
$benchmark = new Benchmark(); | ||
/***************************** SIMPLE BENCHMARKING BY CI *****************************/ | ||
$benchmark->mark('code_start'); | ||
$mathFunctions = ["abs", "acos", "asin", "atan", "floor"]; | ||
$count = 10; | ||
|
@@ -25,7 +16,6 @@ | |
} | ||
$benchmark->mark('code_end'); | ||
|
||
|
||
__show__($benchmark->elapsed_time('code_start', 'code_end')); | ||
__show__($benchmark->memory_usage()); | ||
/***************************** SIMPLE BENCHMARKING BY CI *****************************/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,6 @@ | |
require_once __DIR__ . '/../vendor/autoload.php'; | ||
require __DIR__ . '/func.php'; | ||
|
||
/** | ||
* Project vn-telco-detect. | ||
* Created by PhpStorm. | ||
* User: 713uk13m <[email protected]> | ||
* Date: 9/18/18 | ||
* Time: 17:30 | ||
*/ | ||
|
||
use nguyenanhung\MyDebug\Manager\File; | ||
|
||
$file = new File(); | ||
|
@@ -19,7 +11,4 @@ | |
$path = __DIR__ . '/../tmp'; | ||
$path = realpath($path); | ||
|
||
d($file->directoryScanner($path)); | ||
|
||
|
||
|
||
__show__($file->directoryScanner($path)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,6 @@ | |
require_once __DIR__ . '/../vendor/autoload.php'; | ||
require __DIR__ . '/func.php'; | ||
|
||
/** | ||
* Project vn-telco-detect. | ||
* Created by PhpStorm. | ||
* User: 713uk13m <[email protected]> | ||
* Date: 9/18/18 | ||
* Time: 17:30 | ||
*/ | ||
|
||
use nguyenanhung\MyDebug\Logger; | ||
|
||
// Test Content | ||
|
@@ -48,4 +40,3 @@ | |
__show__($logger->critical($name, $msg . ' - CRITICAL', $context)); | ||
__show__($logger->alert($name, $msg . ' - ALERT', $context)); | ||
__show__($logger->emergency($name, $msg . ' - EMERGENCY', $context)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,19 +2,10 @@ | |
require_once __DIR__ . '/../vendor/autoload.php'; | ||
require __DIR__ . '/func.php'; | ||
|
||
/** | ||
* Project vn-telco-detect. | ||
* Created by PhpStorm. | ||
* User: 713uk13m <[email protected]> | ||
* Date: 9/18/18 | ||
* Time: 17:30 | ||
*/ | ||
|
||
use nguyenanhung\MyDebug\Utils; | ||
|
||
$utils = new Utils(); | ||
$str = 'Nguyễn An Hưng'; | ||
|
||
__show__($utils->getVersion()); | ||
__show__($utils::slugify($str)); | ||
|