asenchi / scrolls

Simple logging
MIT License
158 stars 26 forks source link

Introduce abstraction for stream logging #70

Closed dbussink closed 7 years ago

dbussink commented 7 years ago

This introduces a wrapper class to put the logic for logging to an IO like object. This is to prevent having to put all the logic in the log.rb class itself based if it's a syslog instance or not.

It updates the tests to account for this and also removes the now unused mutex code.

Fixes the broken syslog logging currently on master, which fails with the following error:

private method `print' called for #<Scrolls::SyslogLogger:0x007f50995aa578>

Opted for this approach over implementing print in the syslog class, since that would mean having to chop off the added newline there since syslog already handles the newline logic. By introducing the new class, this can be moved there to where the newline logic is needed.

asenchi commented 7 years ago

This looks legit to me, thanks @dbussink. I'm going to cut a new release at 0.3.9 for this fix, and then begin work to clean things up after being away from the project for some time.