File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
src/main/java/io/appium/java_client/service/local Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 33
33
import org .slf4j .LoggerFactory ;
34
34
import org .slf4j .event .Level ;
35
35
36
+ import java .io .ByteArrayOutputStream ;
36
37
import java .io .File ;
37
38
import java .io .IOException ;
38
39
import java .io .OutputStream ;
@@ -410,16 +411,15 @@ static Slf4jLogMessageContext parseSlf4jContextFromLogMessage(String logMessage)
410
411
public void addLogMessageConsumer (Consumer <String > consumer ) {
411
412
checkNotNull (consumer , "consumer parameter is NULL!" );
412
413
addOutPutStream (new OutputStream () {
413
- StringBuilder lineBuilder = new StringBuilder ();
414
+ private ByteArrayOutputStream outputStream = new ByteArrayOutputStream ();
414
415
415
416
@ Override
416
417
public void write (int chr ) {
417
418
try {
418
- lineBuilder .append ((char ) chr );
419
- Matcher matcher = LOG_MESSAGE_PATTERN .matcher (lineBuilder .toString ());
420
- if (matcher .matches ()) {
421
- consumer .accept (matcher .group (1 ));
422
- lineBuilder = new StringBuilder ();
419
+ outputStream .write (chr );
420
+ if ((chr == '\n' )) {
421
+ consumer .accept (outputStream .toString ());
422
+ outputStream .reset ();
423
423
}
424
424
} catch (Exception e ) {
425
425
// log error and continue
You can’t perform that action at this time.
0 commit comments