infinity-aps / infinity_aps

Infinity APS - oref0 compatible closed loop built on Elixir and Nerves
27 stars 4 forks source link

Direct Logger output to Nerves RingLogger and output log messages via the phoenix application #8

Open tmecklem opened 6 years ago

tmecklem commented 6 years ago

The nerves-project/ring_logger project allows the console log to be replaced by a ring buffer backed logger. It can be attached to any output, and could be passed down to the web ui via phoenix channels. This needs a little bit of work but should be fairly straightforward and low difficulty.

This is necessary for understanding what's happening in the oref0 calls over time without the need to connect to the console via serial.

Key points of what's involved:

David-Gil commented 6 years ago

I'm beginning to think that RingLogger is actually not what we need. I think that we need something that permits custom handlers. See the section about custom handler: https://github.com/elbow-jason/slogger

David-Gil commented 6 years ago

I have also found this library, that forwards Logger events to RabitMQ: https://github.com/duartejc/rogger/blob/master/lib/rogger.ex

David-Gil commented 6 years ago

After studying the code from RingLogger, I've found out that RingLogger.Client is the key. It has the API needed to interact with RingLogger. #17 integrates a copy of RingLogger.Client and adapts it to send logs to the client via channels.