This is a sample project that accompanies the blog post Streams in Scala.
A simple application that reads log files and prints the lines to the console using scala LazyList (LogStream), Akka Stream and Fs2 Stream. The project is divided into three parts:
1. LogStream: This is just an abstraction wrapping LazyList to resists the temptation to use LazyList methods that can cause memory leaks.
2. AkkaStream: Here we use Akka Stream to read the log files and print the lines to the console.
3. Fs2Stream: Here we use Fs2 Stream to read the log files and print the lines to the console.
- Using the following command:
sbt run
, you would be asked to select the stream type to use, available options are:
[(LogStream->l), (AkkaStream->a), (fs2Stream->f)]
- Pick the letter
l
to use LogStream. - choose wether to use filter or by line number, available options are:
[(filter->f), (line number->l)]
- Pick the letter
f
to use filter. - Enter the filter string, check your log files to pick a filter string, for example:
ERROR
. - The program will print the lines that contain the filter string to the console after reading the log files with the time taken.
- Repeat the process to use the other stream types.