Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
journal
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.bundle
lib
spec
.gitignore
.rvmrc
Gemfile
Gemfile.lock
LICENSE
README.md
Rakefile
init.rb
journal.gemspec
redis.cf.sample

README.md

Journal

This gem is intended to provide an easy way to log activities. It uses Redis as storage, if you want to use a similar thing with CouchDB or MongoDB or anyother DB please create a separate Gem for that.

How to use

Put the following line into your Gemfile

gem "journal"

Then create an initializer or some other file loaded by your app and put the following config in it (with proper values) :

Journal.setup do |config|
  config.host = ""
  config.port = ""
  config.expiry = 604800
  config.password = ""
end

how to call

To create an new entry you just have to call the Journal.log method passing the data you want and a key :

Journal.log("oh", "some data")

You can then retrieve a JournalEntry object using the Journal.last method :

a = Journal.last("oh")
a.inspect
# #<JournalEntry:0x007f980c8dacd8 @key="awesome+key", @data="some data@1337007458", @timestamp="1337007458", @date=#<DateTime: 2012-05-14T16:57:38+02:00 ((2456062j,53858s,0n),+7200s,2299161j)>
Something went wrong with that request. Please try again.