<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Log; use Illuminate\Support\Facades\Log; class Logger { private static function rotateLogPath($RQVKS, $f_1X0, $RT58v) { $Jxxd0 = date('Ymd'); return rtrim($RT58v, '/') . '/' . $RQVKS . ($f_1X0 ? '_' . $f_1X0 : '') . '_' . $Jxxd0 . '.log'; } private static function rotateLogPattern($RQVKS, $f_1X0, $RT58v) { return rtrim($RT58v, '/') . '/' . $RQVKS . ($f_1X0 ? '_' . $f_1X0 : '') . '_[0-9][0-9][0-9][0-9]*.log'; } private static function rotateLogClean($RQVKS, $f_1X0, $osgTV, $RT58v) { goto tg6zv; vxYrn: $tmP2D = glob($wiDOj); goto XFw0l; BXhjq: usort($tmP2D, function ($FQzmY, $VugO0) { return strcmp($VugO0, $FQzmY); }); goto H6LSX; tg6zv: $wiDOj = self::rotateLogPattern($RQVKS, $f_1X0, $RT58v); goto vxYrn; H6LSX: foreach (array_slice($tmP2D, $osgTV) as $rZJie) { Log::info('Vendor.LoggerClean - ' . $rZJie); @unlink($rZJie); } goto Cw8YI; XFw0l: if (empty($tmP2D)) { return; } goto BXhjq; Cw8YI: } public static function rotateLog($RQVKS, $f_1X0 = null, $osgTV = 7, $RT58v = null) { goto Sbr3H; PVe30: $fvX1i = self::rotateLogPath($RQVKS, $f_1X0, $RT58v); goto T33QV; Sbr3H: if (null === $RT58v) { $RT58v = storage_path('logs'); } goto PVe30; OPeeq: return $fvX1i; goto yc9kJ; T33QV: if (!file_exists($fvX1i)) { self::rotateLogClean($RQVKS, $f_1X0, $osgTV, $RT58v); } goto OPeeq; yc9kJ: } private static function write($rZJie, $V4Qg5, $o_2ro, $pwDm3) { goto Lraf1; sth_l: return $oj1Tw; goto E4ITr; lvjQQ: @file_put_contents($LNfWe, $oj1Tw . '
', FILE_APPEND); goto sth_l; Lraf1: if (!is_string($pwDm3)) { $pwDm3 = json_encode($pwDm3, JSON_UNESCAPED_UNICODE); } goto I9u3w; I9u3w: $oj1Tw = '[' . sprintf('%05d', getmypid()) . '] ' . date('Y-m-d H:i:s') . " - {$o_2ro}" . ($pwDm3 ? " - {$pwDm3}" : ''); goto daCVl; daCVl: $LNfWe = self::rotateLog($rZJie, $V4Qg5); goto lvjQQ; E4ITr: } public static function info($rZJie, $o_2ro, $pwDm3 = '') { return self::write($rZJie, 'info', $o_2ro, $pwDm3); } public static function error($rZJie, $o_2ro, $pwDm3 = '') { return self::write($rZJie, 'error', $o_2ro, $pwDm3); } }