@@ -174,38 +174,35 @@ impl SealedLog for LogStorage {
174174 if inner. truncated {
175175 return ;
176176 }
177- if let Some ( max_lines) = self . max_lines {
178- if inner. records . len ( ) >= max_lines {
177+ if let Some ( max_lines) = self . max_lines
178+ && inner. records . len ( ) >= max_lines {
179179 inner. records . push ( StoredRecord {
180180 level : Level :: Warn ,
181181 message : "too many lines in the log, truncating it" . into ( ) ,
182182 } ) ;
183183 inner. truncated = true ;
184184 return ;
185185 }
186- }
187186 let mut message = record. args ( ) . to_string ( ) ;
188187
189- if let Some ( max_line_length) = self . max_line_length {
190- if message. len ( ) > max_line_length {
188+ if let Some ( max_line_length) = self . max_line_length
189+ && message. len ( ) > max_line_length {
191190 let mut length = max_line_length - 3 ;
192191 while !message. is_char_boundary ( length) {
193192 length -= 1 ;
194193 }
195194 message = format ! ( "{}..." , & message[ ..length] ) ;
196195 }
197- }
198196
199- if let Some ( max_size) = self . max_size {
200- if inner. size + message. len ( ) >= max_size {
197+ if let Some ( max_size) = self . max_size
198+ && inner. size + message. len ( ) >= max_size {
201199 inner. records . push ( StoredRecord {
202200 level : Level :: Warn ,
203201 message : "too much data in the log, truncating it" . into ( ) ,
204202 } ) ;
205203 inner. truncated = true ;
206204 return ;
207205 }
208- }
209206 inner. size += message. len ( ) ;
210207 inner. records . push ( StoredRecord {
211208 level : record. level ( ) ,
0 commit comments