@@ -10,7 +10,7 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | function rgo(Closure $function, ?Closure $defer = null): int |
| 12 | 12 | { |
| 13 | - return go(function () use ($function, $defer) { |
|
| 13 | + return go(function() use ($function, $defer) { |
|
| 14 | 14 | try { |
| 15 | 15 | if (is_callable($defer)) { |
| 16 | 16 | defer($defer); |
@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | $milliseconds = 0; |
| 128 | 128 | } |
| 129 | 129 | if ($tmp === '%T') { |
| 130 | - $msg[] = date($this->datetime_format, (int)$timestamp) . '.' . (int)$milliseconds; |
|
| 130 | + $msg[] = date($this->datetime_format, ( int ) $timestamp).'.'.( int ) $milliseconds; |
|
| 131 | 131 | } else { |
| 132 | - $msg[] = date($this->datetime_format, (int)$timestamp); |
|
| 132 | + $msg[] = date($this->datetime_format, ( int ) $timestamp); |
|
| 133 | 133 | } |
| 134 | 134 | break; |
| 135 | 135 | case '%Q': |
@@ -160,10 +160,10 @@ discard block |
||
| 160 | 160 | $this->recall_depth + 2); |
| 161 | 161 | if ($tmp === '%F') { |
| 162 | 162 | $trace = $trace[$this->recall_depth]; |
| 163 | - $msg[] = $this->useBasename ? basename($trace['file']) . ':' . $trace['line'] : $trace['file'] . ':' . $trace['line']; |
|
| 163 | + $msg[] = $this->useBasename ? basename($trace['file']).':'.$trace['line'] : $trace['file'].':'.$trace['line']; |
|
| 164 | 164 | } else { |
| 165 | 165 | $trace = $trace[$this->recall_depth + 1]; |
| 166 | - $msg[] = $trace['class'] . $trace['type'] . $trace['function']; |
|
| 166 | + $msg[] = $trace['class'].$trace['type'].$trace['function']; |
|
| 167 | 167 | } |
| 168 | 168 | break; |
| 169 | 169 | case '%U': |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | $color = ArrayHelper::getValue($template, '%c'); |
| 191 | 191 | $color && $msg['%c'] = $color; |
| 192 | - $key = $this->appName . ($module ? '_' . $module : ''); |
|
| 192 | + $key = $this->appName.($module ? '_'.$module : ''); |
|
| 193 | 193 | $this->buffer[$key][] = $msg; |
| 194 | 194 | $this->flush(); |
| 195 | 195 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | { |
| 203 | 203 | if (!empty($this->buffer) && $flush || ($this->bufferSize !== 0 && $this->bufferSize <= count($this->buffer))) { |
| 204 | 204 | foreach ($this->targetList as $index => $target) { |
| 205 | - rgo(function () use ($target, $flush) { |
|
| 205 | + rgo(function() use ($target, $flush) { |
|
| 206 | 206 | $target->export($this->buffer); |
| 207 | 207 | }); |
| 208 | 208 | } |
@@ -157,7 +157,7 @@ |
||
| 157 | 157 | */ |
| 158 | 158 | public static function getColor(string $color): string |
| 159 | 159 | { |
| 160 | - return (string)ArrayHelper::getValue(static::$colors, $color, ''); |
|
| 160 | + return ( string ) ArrayHelper::getValue(static::$colors, $color, ''); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | public function __construct(array $target, array $configs = []) |
| 21 | 21 | { |
| 22 | 22 | $this->template = explode($this->split, ini_get('seaslog.default_template')); |
| 23 | - ini_set('seaslog.recall_depth', (string)$this->recall_depth); |
|
| 23 | + ini_set('seaslog.recall_depth', ( string ) $this->recall_depth); |
|
| 24 | 24 | parent::__construct($target, $configs); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $template = $this->getUserTemplate(); |
| 56 | 56 | $module = ArrayHelper::remove($context, 'module'); |
| 57 | 57 | if ($module !== null) { |
| 58 | - Seaslog::setLogger($this->appName . '_' . $module); |
|
| 58 | + Seaslog::setLogger($this->appName.'_'.$module); |
|
| 59 | 59 | } |
| 60 | 60 | isset($template['%Q']) && Seaslog::setRequestID($template['%Q']); |
| 61 | 61 | foreach (array_filter([ |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | case AbstractConfig::TYPE_FIELD: |
| 76 | 76 | $template = implode($this->split, $template); |
| 77 | 77 | } |
| 78 | - $message = $template . $this->split . $message; |
|
| 78 | + $message = $template.$this->split.$message; |
|
| 79 | 79 | } |
| 80 | 80 | Seaslog::$level($message); |
| 81 | 81 | $this->flush(); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | if (($flush || ($total = Seaslog::getBufferCount()) >= $this->bufferSize) && ($buffer = Seaslog::getBuffer()) !== false) { |
| 92 | 92 | Seaslog::flushBuffer(0); |
| 93 | 93 | foreach ($this->targetList as $index => $target) { |
| 94 | - rgo(function () use ($target, $buffer, $flush) { |
|
| 94 | + rgo(function() use ($target, $buffer, $flush) { |
|
| 95 | 95 | $target->export($buffer); |
| 96 | 96 | }); |
| 97 | 97 | } |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | foreach ($this->targetList as $target) { |
| 55 | 55 | $target->setTemplate($this->template)->setCustomerFieldType($this->customerType)->setSplit($this->split); |
| 56 | 56 | } |
| 57 | - register_shutdown_function(function () { |
|
| 57 | + register_shutdown_function(function() { |
|
| 58 | 58 | $this->flush(true); |
| 59 | 59 | }); |
| 60 | 60 | $this->tick > 0 && Timer::tick($this->tick * 1000, [$this, 'flush'], [true]); |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public static function analyzerCount($level = 'all', $log_path = '*', $key_word = null) |
| 219 | 219 | { |
| 220 | - return SeasLog::analyzerCount($level, $log_path, (string)$key_word); |
|
| 220 | + return SeasLog::analyzerCount($level, $log_path, ( string ) $key_word); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /** |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | return SeasLog::analyzerDetail( |
| 244 | 244 | $level, |
| 245 | 245 | $log_path, |
| 246 | - (string)$key_word, |
|
| 246 | + ( string ) $key_word, |
|
| 247 | 247 | $start, |
| 248 | 248 | $limit, |
| 249 | 249 | $order |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | */ |
| 336 | 336 | public function log($level, $message, array $context = array()) |
| 337 | 337 | { |
| 338 | - if ((int)$level < self::$RequestLevel) { |
|
| 338 | + if (( int ) $level < self::$RequestLevel) { |
|
| 339 | 339 | return; |
| 340 | 340 | } |
| 341 | 341 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $level = $this->getLevelColor(trim($msg[$this->levelIndex])); |
| 83 | 83 | if (isset($this->colorTemplate[$index])) { |
| 84 | 84 | $color = $this->colorTemplate[$index]; |
| 85 | - $msgValue = is_string($msgValue) ? trim($msgValue) : (string)$msgValue; |
|
| 85 | + $msgValue = is_string($msgValue) ? trim($msgValue) : ( string ) $msgValue; |
|
| 86 | 86 | switch ($color) { |
| 87 | 87 | case self::COLOR_LEVEL: |
| 88 | 88 | $context[] = $this->color->apply($level, $msgValue); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | if (isset($context)) { |
| 104 | - echo implode(' ' . $this->color->apply($this->splitColor, '|') . ' ', $context) . PHP_EOL; |
|
| 104 | + echo implode(' '.$this->color->apply($this->splitColor, '|').' ', $context).PHP_EOL; |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $ranColor = $this->default; |
| 88 | 88 | } |
| 89 | 89 | foreach ($msg as $index => $msgValue) { |
| 90 | - $msg[$index] = is_string($msgValue) ? trim($msgValue) : (string)$msgValue; |
|
| 90 | + $msg[$index] = is_string($msgValue) ? trim($msgValue) : ( string ) $msgValue; |
|
| 91 | 91 | $level = $this->getLevelColor(trim($msg[$this->levelIndex])); |
| 92 | 92 | if (isset($this->colorTemplate[$index])) { |
| 93 | 93 | $color = $this->colorTemplate[$index]; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | $msg = json_encode([$msg, $colors], JSON_UNESCAPED_UNICODE); |
| 112 | - rgo(function () use ($swooleServer, $fd, $msg) { |
|
| 112 | + rgo(function() use ($swooleServer, $fd, $msg) { |
|
| 113 | 113 | $swooleServer->push($fd, $msg); |
| 114 | 114 | }); |
| 115 | 115 | } |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | continue; |
| 57 | 57 | } |
| 58 | 58 | ArrayHelper::remove($msg, '%c'); |
| 59 | - $msg = $module . '@' . str_replace(PHP_EOL, '', implode($this->split, $msg)) . PHP_EOL; |
|
| 59 | + $msg = $module.'@'.str_replace(PHP_EOL, '', implode($this->split, $msg)).PHP_EOL; |
|
| 60 | 60 | $connection->send($msg); |
| 61 | 61 | } |
| 62 | 62 | } |