| 123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- class serverLog {
- public static function printLog(string $_log){
- if (stripos($_log, 'error') !== false) {
- echo '<div class="error">' . $_log . '</div>';
- } elseif (stripos($_log, 'warn') !== false) {
- echo '<div class="warning">' . $_log . '</div>';
- } elseif (stripos($_log, 'notice') !== false) {
- echo '<div class="notice">' . $_log . '</div>';
- } else {
- echo '<div>' . $_log . '</div>';
- }
- }
- public static function filtreLog(string $_log){
- if(self::ifFolderWww($_log)){
- self::printLog($_log);
- } elseif(self::ifFolderDomain($_log)){
- self::printLog($_log);
- } elseif(self::ifGeneral($_log)){
- self::printLog($_log);
- }
- }
- private static function ifFolderWww(string $_log){
- return (stripos($_log, DOCUMENT_ROOT) !== false) ? TRUE : FALSE;
- }
- private static function ifFolderDomain(string $_log){
- return (stripos($_log, DOMAIN_CMS) !== false) ? TRUE : FALSE;
- }
- private static function ifGeneral(string $_log){
- return (stripos($_log, "/var/www/") == FALSE AND stripos($_log, "https://") == FALSE) ? TRUE : FALSE;
- }
- }
|