Completed
Push — 6.0 ( 482461...384317 )
by liu
05:47
created
src/think/log/driver/File.php 1 patch
Spacing   +14 added lines, -15 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\log\driver;
14 14
 
@@ -86,8 +86,7 @@  discard block
 block discarded – undo
86 86
                 }
87 87
 
88 88
                 $message[] = $this->config['json'] ?
89
-                json_encode(['time' => $time, 'type' => $type, 'msg' => $msg], $this->config['json_options']) :
90
-                sprintf($this->config['format'], $time, $type, $msg);
89
+                json_encode(['time' => $time, 'type' => $type, 'msg' => $msg], $this->config['json_options']) : sprintf($this->config['format'], $time, $type, $msg);
91 90
             }
92 91
 
93 92
             if (true === $this->config['apart_level'] || in_array($type, $this->config['apart_level'])) {
@@ -125,7 +124,7 @@  discard block
 block discarded – undo
125 124
             $info[$type] = is_array($msg) ? implode(PHP_EOL, $msg) : $msg;
126 125
         }
127 126
 
128
-        $message = implode(PHP_EOL, $info) . PHP_EOL;
127
+        $message = implode(PHP_EOL, $info).PHP_EOL;
129 128
 
130 129
         return error_log($message, 3, $destination);
131 130
     }
@@ -138,13 +137,13 @@  discard block
 block discarded – undo
138 137
     protected function getMasterLogFile(): string
139 138
     {
140 139
         if (empty($this->config['path'])) {
141
-            $this->config['path'] = $this->app->getRuntimePath() . 'log' . DIRECTORY_SEPARATOR;
140
+            $this->config['path'] = $this->app->getRuntimePath().'log'.DIRECTORY_SEPARATOR;
142 141
         } elseif (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) {
143 142
             $this->config['path'] .= DIRECTORY_SEPARATOR;
144 143
         }
145 144
 
146 145
         if ($this->config['max_files']) {
147
-            $files = glob($this->config['path'] . '*.log');
146
+            $files = glob($this->config['path'].'*.log');
148 147
 
149 148
             try {
150 149
                 if (count($files) > $this->config['max_files']) {
@@ -158,17 +157,17 @@  discard block
 block discarded – undo
158 157
         if ($this->config['single']) {
159 158
             $name        = is_string($this->config['single']) ? $this->config['single'] : 'single';
160 159
             $cli         = $this->isCli ? '_cli' : '';
161
-            $destination = $this->config['path'] . $name . $cli . '.log';
160
+            $destination = $this->config['path'].$name.$cli.'.log';
162 161
         } else {
163 162
             $cli = $this->isCli ? '_cli' : '';
164 163
 
165 164
             if ($this->config['max_files']) {
166
-                $filename = date('Ymd') . $cli . '.log';
165
+                $filename = date('Ymd').$cli.'.log';
167 166
             } else {
168
-                $filename = date('Ym') . DIRECTORY_SEPARATOR . date('d') . $cli . '.log';
167
+                $filename = date('Ym').DIRECTORY_SEPARATOR.date('d').$cli.'.log';
169 168
             }
170 169
 
171
-            $destination = $this->config['path'] . $filename;
170
+            $destination = $this->config['path'].$filename;
172 171
         }
173 172
 
174 173
         return $destination;
@@ -188,14 +187,14 @@  discard block
 block discarded – undo
188 187
         if ($this->config['single']) {
189 188
             $name = is_string($this->config['single']) ? $this->config['single'] : 'single';
190 189
 
191
-            $name .= '_' . $type;
190
+            $name .= '_'.$type;
192 191
         } elseif ($this->config['max_files']) {
193
-            $name = date('Ymd') . '_' . $type . $cli;
192
+            $name = date('Ymd').'_'.$type.$cli;
194 193
         } else {
195
-            $name = date('d') . '_' . $type . $cli;
194
+            $name = date('d').'_'.$type.$cli;
196 195
         }
197 196
 
198
-        return $path . DIRECTORY_SEPARATOR . $name . '.log';
197
+        return $path.DIRECTORY_SEPARATOR.$name.'.log';
199 198
     }
200 199
 
201 200
     /**
@@ -208,7 +207,7 @@  discard block
 block discarded – undo
208 207
     {
209 208
         if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) {
210 209
             try {
211
-                rename($destination, dirname($destination) . DIRECTORY_SEPARATOR . time() . '-' . basename($destination));
210
+                rename($destination, dirname($destination).DIRECTORY_SEPARATOR.time().'-'.basename($destination));
212 211
             } catch (\Exception $e) {
213 212
                 //
214 213
             }
Please login to merge, or discard this patch.