Files
CoreLibs-Composer-All/src/Logging/Logger/MessageLevel.php

89 lines
1.7 KiB
PHP
Raw Normal View History

2023-09-08 18:38:19 +09:00
<?php // phpcs:disable Generic.Files.LineLength
/**
* AUTOR: Clemens Schwaighofer
* CREATED: 2023-09-08
* DESCRIPTION:
* Error message return levels
*/
declare(strict_types=1);
namespace CoreLibs\Logging\Logger;
enum MessageLevel: int
{
case ok = 100;
case success = 150; // special for file uploads
2023-09-08 18:38:19 +09:00
case info = 200;
2023-09-27 11:43:12 +09:00
case notice = 250;
2023-09-08 18:38:19 +09:00
case warn = 300;
case error = 400;
case abort = 500;
case crash = 550;
case unknown = 600;
/**
* @param string $name any string name, if not matching use unkown
* @return static
*/
public static function fromName(string $name): self
{
return match (strtolower($name)) {
'ok' => self::ok,
Various updates as follows * commit 5cec54d508fd4a34de509b3ac28d6277b6abc090 (HEAD -> master, all/master, all/development, all/NewFeatures) | log size 644 | Author: Clemens Schwaighofer <clemens.schwaighofer@egplusww.com> | Date: 2024-09-20 13:33:19 +0900 | | Add "Success" to message logging levels, fixes for PHP 8.4, other preg_match fixes | | The Logger/MessageLevel gets "success" as level 110 to something a bit | heigher than "ok" which is the general "OK" for anything ending without | an error. The "success" is currently only used in file uploads with the | java script ajax file uploader | | Fix any "type $var = null" with correctly "?type $var = null" for PHP 8.4 (phphan) | | Fix preg match no return catches for DB IO compare version and for language | look up. | | 4dev/tests/Logging/CoreLibsLoggingErrorMessagesTest.php | 5 +++++ | www/admin/class_test.html.php | 1 + | www/admin/class_test.php | 2 +- | www/admin/layout/javascript/edit.jq.js | 2 +- | www/lib/CoreLibs/Admin/Backend.php | 6 +++--- | www/lib/CoreLibs/Basic.php | 2 +- | www/lib/CoreLibs/Convert/Extends/SetVarTypeMain.php | 6 +++--- | www/lib/CoreLibs/Convert/SetVarTypeNull.php | 6 +++--- | www/lib/CoreLibs/DB/IO.php | 24 ++++++++++++++++++------ | www/lib/CoreLibs/Language/GetLocale.php | 4 ++-- | www/lib/CoreLibs/Logging/Logger/MessageLevel.php | 2 ++ | www/lib/CoreLibs/Output/Form/Elements.php | 12 ++++++------ | www/lib/CoreLibs/Template/HtmlBuilder/Element.php | 4 ++-- | 13 files changed, 48 insertions(+), 28 deletions(-) | * commit 8e60c992f109993b40d9e5ec9354ffb7d7db9f79 | log size 123 | Author: Clemens Schwaighofer <clemens.schwaighofer@egplusww.com> | Date: 2024-09-03 12:06:01 +0900 | | Fixes phan/phpstan | | phpstan.neon | 6 +++--- | www/lib/CoreLibs/Get/System.php | 2 +- | www/lib/CoreLibs/Template/HtmlBuilder/Block.php | 4 ---- | 3 files changed, 4 insertions(+), 8 deletions(-) | * commit 1b5437b675f6ceda4318f19522d47a08f28f95a8 | log size 147 | Author: Clemens Schwaighofer <clemens.schwaighofer@egplusww.com> | Date: 2024-09-03 11:58:36 +0900 | | Add testing for new added bom utf8 replace | | 4dev/tests/Convert/CoreLibsConvertStringsTest.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ | 4dev/tests/Convert/data/UTF8.csv | 1 + | 4dev/tests/Convert/data/UTF8BOM.csv | 1 + | 4dev/tests/Get/CoreLibsGetSystemTest.php | 23 +++++++++++++++++++++++ | www/admin/class_test.system.php | 4 +++- | 5 files changed, 76 insertions(+), 1 deletion(-) | * commit ef80cba5610b8acae8fc11d3f0a441c1f5a03735 | log size 659 | Author: Clemens Schwaighofer <clemens.schwaighofer@egplusww.com> | Date: 2024-09-03 09:49:01 +0900 | | Add new functions: get IPs, strip UTF8 BOM from text, text updates | | Add the following new static methods | | Convert\Strings::stripUTF8BomBytes: removes the UTF8 BOM bytes from the beginning of a line | Used for CSV files created in Excel for the first header entry (line 0/row 0) | | Get\Systen::getIpAddresses: gets all IP addresses for the the current access user | and returns an array | | Moved the frontend folder detection from the first load config to the config.path.php | | Cleaned up the translations JS scripts | | 4dev/bin/create_mo.sh | 9 +++++---- | 4dev/bin/mo_to_js.sh | 63 +++++++++++++++++++++++++++++++++++---------------------------- | www/configs/config.path.php | 16 +++++++++++++++- | www/configs/config.php | 15 +-------------- | www/lib/CoreLibs/Convert/Strings.php | 12 ++++++++++++ | www/lib/CoreLibs/DB/IO.php | 2 +- | www/lib/CoreLibs/Get/System.php | 23 +++++++++++++++++++++++ | www/lib/CoreLibs/Template/HtmlBuilder/Block.php | 37 ++++++++++++++++++++++++++----------- | 8 files changed, 118 insertions(+), 59 deletions(-) | * commit 2d71e760e8fb7b4b0a5552a2f62bedffad928f4f | log size 120 | Author: Clemens Schwaighofer <clemens.schwaighofer@egplusww.com> | Date: 2024-08-21 11:45:17 +0900 | | Composer update | | www/composer.lock | 12 ++++++------ | www/lib/CoreLibs/Template/SmartyExtend.php | 3 ++- | www/vendor/composer/installed.json | 14 +++++++------- | www/vendor/composer/installed.php | 6 +++--- | www/vendor/gullevek/dotenv/Readme.md | 23 +++++++++++++++++++++++ | www/vendor/gullevek/dotenv/src/DotEnv.php | 13 ++++++++++--- | 6 files changed, 51 insertions(+), 20 deletions(-) | * commit a8d07634ffaf961a37557437aac1f202ae18fa6e | log size 182 | Author: Clemens Schwaighofer <clemens.schwaighofer@egplusww.com> | Date: 2024-08-07 13:41:09 +0900 | | Add soba.egplusww.jp as local development host, jshint esversion update to 11 | | www/admin/layout/javascript/edit.jq.js | 2 +- | www/configs/config.host.php | 28 +++++++++++----------------- | 2 files changed, 12 insertions(+), 18 deletions(-) |
2024-09-20 13:40:20 +09:00
'success' => self::success,
2023-09-08 18:38:19 +09:00
'info' => self::info,
2023-09-27 11:43:12 +09:00
'notice' => self::notice,
2023-09-08 18:38:19 +09:00
'warn', 'warning' => self::warn,
'error' => self::error,
'abort' => self::abort,
'crash' => self::crash,
default => self::unknown,
};
}
/**
* @param int $value
* @return static
*/
public static function fromValue(int $value): self
{
return self::tryFrom($value) ?? self::unknown;
}
/**
* Returns true if the passed $level is higher or equal to $this
*
* @param MessageLevel $level
* @return bool
*/
public function includes(MessageLevel $level): bool
{
return $this->value <= $level->value;
}
/**
* If level is higher than set one
*
* @param MessageLevel $level
* @return bool
*/
public function isHigherThan(MessageLevel $level): bool
{
return $this->value > $level->value;
}
/**
* if level is lower than set one
*
* @param MessageLevel $level
* @return bool
*/
public function isLowerThan(MessageLevel $level): bool
{
return $this->value < $level->value;
}
2023-09-08 18:38:19 +09:00
}
// __END__