No release in over 3 years
A logging device for the lumberjack gem that writes log entries as JSON documentspec.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 3.0

Runtime

 Project Readme

Lumberjack Redis Device

Continuous Integration Regression Test Ruby Style Guide Gem Version

This is a simple reference implementation of a device for the lumberjack to send logs to a data store.

Log data will be stored in a Redis list. This will likely not scale to handle permanent or large log storage, but it can be useful as a temporary store in log shipment, or as a debug tool for seeing only recent log entries.

The number of entries in the list can be capped with the :limit paramter on the constructor. An expiration time can also be set on the redis key as well with the :ttl parameter.

# create a device to save to the app.log key in redis
# with a limit of 1000 entries that expires one hour after the last write.
device = Lumberjack::RedisDevice.new("app.log", redis: Redis.new, limit: 1000, ttl: 3600)

The log entries can then be read out again with the read method. The result will be an array of Lumberjack::LogEntry objects in the reverse order that they were written in (i.e. newest first).

entries = device.read