| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- class serverLog {
- public static function printLog(string $_log){
- if (stripos($_log, 'error') !== false) {
- echo '<div class="error">' . $_log . '</div>';
- } elseif (stripos($_log, 'fatal') !== false) {
- echo '<div class="error">' . $_log . '</div>';
- } elseif (stripos($_log, 'warn') !== false OR stripos($_log, 'alert') !== false) {
- echo '<div class="warning">' . $_log . '</div>';
- } elseif (stripos($_log, 'notice') !== false) {
- echo '<div class="notice">' . $_log . '</div>';
- } else {
- echo '<div class="grey">' . $_log . '</div>';
- }
- }
- public static function filtreLog(string $_log){
- $log = self::hidePassword($_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;
- }
- private static function hidePassword($input) {
- return preg_replace("/('password'\s*=>\s*)'[^']*'/", "$1'####'", $input);
- }
- }
|