/** * Removes all rows for the channel with the specified id * * @param id the id of the logging channel to remove */ public void removeChannelFromBuffer( String id ) { lock.writeLock().lock(); try { buffer.removeIf( line -> id.equals( getLogChId( line ) ) ); } finally { lock.writeLock().unlock(); } }
public void removeGeneralMessages() { lock.writeLock().lock(); try { buffer.removeIf( line -> isGeneral( getLogChId( line ) ) ); } finally { lock.writeLock().unlock(); } }
/** * @param channelId channel IDs to grab * @param includeGeneral include general log lines * @param from * @param to * @return */ public List<KettleLoggingEvent> getLogBufferFromTo( List<String> channelId, boolean includeGeneral, int from, int to ) { lock.readLock().lock(); try { Stream<BufferLine> bufferStream = buffer.stream().filter( line -> line.getNr() > from && line.getNr() <= to ); if ( channelId != null ) { bufferStream = bufferStream.filter( line -> { String logChannelId = getLogChId( line ); return includeGeneral ? isGeneral( logChannelId ) || channelId.contains( logChannelId ) : channelId.contains( logChannelId ); } ); } return bufferStream.map( BufferLine::getEvent ).collect( Collectors.toList() ); } finally { lock.readLock().unlock(); } }