Skip to content

Commit

Permalink
Release version 4.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hungnguyenhp committed Aug 17, 2023
1 parent b9a8577 commit de15df2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
60 changes: 30 additions & 30 deletions src/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function getGlobalLoggerLevel()
public function setGlobalLoggerLevel(string $globalLoggerLevel = null): Logger
{
if (!empty($globalLoggerLevel) && is_string($globalLoggerLevel)) {
$this->globalLoggerLevel = strtolower($globalLoggerLevel);
$this->globalLoggerLevel = mb_strtolower($globalLoggerLevel);
}

return $this;
Expand Down Expand Up @@ -312,20 +312,20 @@ public function setLoggerLineFormat(string $loggerLineFormat = null): Logger
* @param string $msg Log Message write to Log
* @param array|string $context Log Context aka Log Message Array format
*
* @return bool|null TRUE nếu ghi log thành công, FALSE nếu ghi log thất bại, Message Error nếu có lỗi Exception xảy ra, ngoài ra các trường hợp khác sẽ trả về mã Null
* @return bool TRUE nếu ghi log thành công, FALSE nếu ghi log thất bại, Message Error nếu có lỗi Exception xảy ra, ngoài ra các trường hợp khác sẽ trả về mã Null
*
* @author : 713uk13m <dev@nguyenanhung.com>
* @copyright: 713uk13m <dev@nguyenanhung.com>
* @time : 08/17/2021 05:20
*
* @example log('info', 'test', 'Log Test', [])
*/
public function log(string $level = '', string $name = 'log', string $msg = 'My Message', array|string $context = array())
public function log(string $level = '', string $name = 'log', string $msg = 'My Message', array|string $context = array()): bool
{
if (!is_array($context)) {
$context = array($context);
}
$level = strtolower(trim($level));
$level = mb_strtolower(trim($level));
if ($this->DEBUG === true) {
if (!class_exists(MonoLogger::class)) {
if (function_exists('log_message')) {
Expand All @@ -351,26 +351,26 @@ public function log(string $level = '', string $name = 'log', string $msg = 'My
in_array($this->globalLoggerLevel, $listLevel, true)
) {
// If valid globalLoggerLevel -> use globalLoggerLevel
$useLevel = strtolower($this->globalLoggerLevel);
$useLevel = mb_strtolower($this->globalLoggerLevel);
} else {
// Default Level is INFO
$useLevel = in_array($level, $listLevel) ? trim($level) : trim('info');
}
if ($useLevel == 'debug') {
if ($useLevel === 'debug') {
$keyLevel = MonoLogger::DEBUG;
} elseif ($useLevel == 'info') {
} elseif ($useLevel === 'info') {
$keyLevel = MonoLogger::INFO;
} elseif ($useLevel == 'notice') {
} elseif ($useLevel === 'notice') {
$keyLevel = MonoLogger::NOTICE;
} elseif ($useLevel == 'warning') {
} elseif ($useLevel === 'warning') {
$keyLevel = MonoLogger::WARNING;
} elseif ($useLevel == 'error') {
} elseif ($useLevel === 'error') {
$keyLevel = MonoLogger::ERROR;
} elseif ($useLevel == 'critical') {
} elseif ($useLevel === 'critical') {
$keyLevel = MonoLogger::CRITICAL;
} elseif ($useLevel == 'alert') {
} elseif ($useLevel === 'alert') {
$keyLevel = MonoLogger::ALERT;
} elseif ($useLevel == 'emergency') {
} elseif ($useLevel === 'emergency') {
$keyLevel = MonoLogger::EMERGENCY;
} else {
$keyLevel = MonoLogger::WARNING;
Expand Down Expand Up @@ -402,7 +402,7 @@ public function log(string $level = '', string $name = 'log', string $msg = 'My
}
}

return null;
return false;
}

/**
Expand All @@ -412,13 +412,13 @@ public function log(string $level = '', string $name = 'log', string $msg = 'My
* @param string $msg Log Message write to Log
* @param array|string $context Log Context aka Log Message Array format
*
* @return bool|null TRUE nếu ghi log thành công, FALSE nếu ghi log thất bại, Message Error nếu có lỗi Exception xảy ra, ngoài ra các trường hợp khác sẽ trả về mã Null
* @return bool TRUE nếu ghi log thành công, FALSE nếu ghi log thất bại, Message Error nếu có lỗi Exception xảy ra, ngoài ra các trường hợp khác sẽ trả về mã Null
*
* @author : 713uk13m <dev@nguyenanhung.com>
* @copyright: 713uk13m <dev@nguyenanhung.com>
* @time : 08/17/2021 07:35
*/
public function debug(string $name = 'log', string $msg = 'My Message', array|string $context = array())
public function debug(string $name = 'log', string $msg = 'My Message', array|string $context = array()): bool
{
if (!is_array($context)) {
$context = array($context);
Expand All @@ -434,13 +434,13 @@ public function debug(string $name = 'log', string $msg = 'My Message', array|st
* @param string $msg Log Message write to Log
* @param array|string $context Log Context aka Log Message Array format
*
* @return bool|null TRUE nếu ghi log thành công, FALSE nếu ghi log thất bại, Message Error nếu có lỗi Exception xảy ra, ngoài ra các trường hợp khác sẽ trả về mã Null
* @return bool TRUE nếu ghi log thành công, FALSE nếu ghi log thất bại, Message Error nếu có lỗi Exception xảy ra, ngoài ra các trường hợp khác sẽ trả về mã Null
*
* @author : 713uk13m <dev@nguyenanhung.com>
* @copyright: 713uk13m <dev@nguyenanhung.com>
* @time : 08/17/2021 07:35
*/
public function info(string $name = 'log', string $msg = 'My Message', array|string $context = array())
public function info(string $name = 'log', string $msg = 'My Message', array|string $context = array()): bool
{
if (!is_array($context)) {
$context = array($context);
Expand All @@ -456,13 +456,13 @@ public function info(string $name = 'log', string $msg = 'My Message', array|str
* @param string $msg Log Message write to Log
* @param array|string $context Log Context aka Log Message Array format
*
* @return bool|null TRUE nếu ghi log thành công, FALSE nếu ghi log thất bại, Message Error nếu có lỗi Exception xảy ra, ngoài ra các trường hợp khác sẽ trả về mã Null
* @return bool TRUE nếu ghi log thành công, FALSE nếu ghi log thất bại, Message Error nếu có lỗi Exception xảy ra, ngoài ra các trường hợp khác sẽ trả về mã Null
*
* @author : 713uk13m <dev@nguyenanhung.com>
* @copyright: 713uk13m <dev@nguyenanhung.com>
* @time : 08/17/2021 07:35
*/
public function notice(string $name = 'log', string $msg = 'My Message', array|string $context = array())
public function notice(string $name = 'log', string $msg = 'My Message', array|string $context = array()): bool
{
if (!is_array($context)) {
$context = array($context);
Expand All @@ -478,13 +478,13 @@ public function notice(string $name = 'log', string $msg = 'My Message', array|s
* @param string $msg Log Message write to Log
* @param array|string $context Log Context aka Log Message Array format
*
* @return bool|null TRUE nếu ghi log thành công, FALSE nếu ghi log thất bại, Message Error nếu có lỗi Exception xảy ra, ngoài ra các trường hợp khác sẽ trả về mã Null
* @return bool TRUE nếu ghi log thành công, FALSE nếu ghi log thất bại, Message Error nếu có lỗi Exception xảy ra, ngoài ra các trường hợp khác sẽ trả về mã Null
*
* @author : 713uk13m <dev@nguyenanhung.com>
* @copyright: 713uk13m <dev@nguyenanhung.com>
* @time : 08/17/2021 07:35
*/
public function warning(string $name = 'log', string $msg = 'My Message', array|string $context = array())
public function warning(string $name = 'log', string $msg = 'My Message', array|string $context = array()): bool
{
if (!is_array($context)) {
$context = array($context);
Expand All @@ -500,13 +500,13 @@ public function warning(string $name = 'log', string $msg = 'My Message', array|
* @param string $msg Log Message write to Log
* @param array|string $context Log Context aka Log Message Array format
*
* @return bool|null TRUE nếu ghi log thành công, FALSE nếu ghi log thất bại, Message Error nếu có lỗi Exception xảy ra, ngoài ra các trường hợp khác sẽ trả về mã Null
* @return bool TRUE nếu ghi log thành công, FALSE nếu ghi log thất bại, Message Error nếu có lỗi Exception xảy ra, ngoài ra các trường hợp khác sẽ trả về mã Null
*
* @author : 713uk13m <dev@nguyenanhung.com>
* @copyright: 713uk13m <dev@nguyenanhung.com>
* @time : 08/17/2021 07:35
*/
public function error(string $name = 'log', string $msg = 'My Message', array|string $context = array())
public function error(string $name = 'log', string $msg = 'My Message', array|string $context = array()): bool
{
if (!is_array($context)) {
$context = array($context);
Expand All @@ -522,13 +522,13 @@ public function error(string $name = 'log', string $msg = 'My Message', array|st
* @param string $msg Log Message write to Log
* @param array|string $context Log Context aka Log Message Array format
*
* @return bool|null TRUE nếu ghi log thành công, FALSE nếu ghi log thất bại, Message Error nếu có lỗi Exception xảy ra, ngoài ra các trường hợp khác sẽ trả về mã Null
* @return bool TRUE nếu ghi log thành công, FALSE nếu ghi log thất bại, Message Error nếu có lỗi Exception xảy ra, ngoài ra các trường hợp khác sẽ trả về mã Null
*
* @author : 713uk13m <dev@nguyenanhung.com>
* @copyright: 713uk13m <dev@nguyenanhung.com>
* @time : 08/17/2021 07:35
*/
public function critical(string $name = 'log', string $msg = 'My Message', array|string $context = array())
public function critical(string $name = 'log', string $msg = 'My Message', array|string $context = array()): bool
{
if (!is_array($context)) {
$context = array($context);
Expand All @@ -544,13 +544,13 @@ public function critical(string $name = 'log', string $msg = 'My Message', array
* @param string $msg Log Message write to Log
* @param array|string $context Log Context aka Log Message Array format
*
* @return bool|null TRUE nếu ghi log thành công, FALSE nếu ghi log thất bại, Message Error nếu có lỗi Exception xảy ra, ngoài ra các trường hợp khác sẽ trả về mã Null
* @return bool TRUE nếu ghi log thành công, FALSE nếu ghi log thất bại, Message Error nếu có lỗi Exception xảy ra, ngoài ra các trường hợp khác sẽ trả về mã Null
*
* @author : 713uk13m <dev@nguyenanhung.com>
* @copyright: 713uk13m <dev@nguyenanhung.com>
* @time : 08/17/2021 07:35
*/
public function alert(string $name = 'log', string $msg = 'My Message', array|string $context = array())
public function alert(string $name = 'log', string $msg = 'My Message', array|string $context = array()): bool
{
if (!is_array($context)) {
$context = array($context);
Expand All @@ -566,13 +566,13 @@ public function alert(string $name = 'log', string $msg = 'My Message', array|st
* @param string $msg Log Message write to Log
* @param array|string $context Log Context aka Log Message Array format
*
* @return bool|null TRUE nếu ghi log thành công, FALSE nếu ghi log thất bại, Message Error nếu có lỗi Exception xảy ra, ngoài ra các trường hợp khác sẽ trả về mã Null
* @return bool TRUE nếu ghi log thành công, FALSE nếu ghi log thất bại, Message Error nếu có lỗi Exception xảy ra
*
* @author : 713uk13m <dev@nguyenanhung.com>
* @copyright: 713uk13m <dev@nguyenanhung.com>
* @time : 08/17/2021 07:35
*/
public function emergency(string $name = 'log', string $msg = 'My Message', array|string $context = array())
public function emergency(string $name = 'log', string $msg = 'My Message', array|string $context = array()): bool
{
if (!is_array($context)) {
$context = array($context);
Expand Down
2 changes: 1 addition & 1 deletion src/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
interface Project
{
const VERSION = '4.0.1';
const VERSION = '4.0.2';

/**
* Hàm lấy thông tin phiên bản Packages
Expand Down

0 comments on commit de15df2

Please sign in to comment.