Closed tobyweston closed 6 years ago
NB. the current approach will take a standard text based log file and parse it on the fly to a List[LogMessage]
. This has the problem where the LogParser
can handle newlines and parse multi-line log messages into valid LogMessage
s, any client of the parser can't read a file a (conventional) line at a time.
So anything that goes Source.fromFile(...).getLines()
can not feed the LogParser
.
Alternatives might be to write the log file as JSON in the first place (which I didn't do first time round as I wanted a super-lightweight logging framework) or use a custom line ending delimiter in the log file (\u0000
springs to mind).
So instead of:
Source.fromFile(source).getLines()
You'd use a Scanner
:
new Scanner(new File(source)).useDelimiter("\u0000").asScala
Still to do:
Make the log viewable in the app and show dates / times.
Bit of a shame as I made an effort to display interesting startup output (below)
Which would get muddled a little if I swap in an arbitrary logging framework: