Permalink
Browse files

edit readme

  • Loading branch information...
pagedegeek committed May 30, 2012
1 parent ac6c694 commit 61b6a11797efb2ed0014ec67cbdfe68d05e14150
Showing with 14 additions and 0 deletions.
  1. +14 −0 README.md → README.markdown
@@ -20,28 +20,38 @@ Or install it yourself as:
### In your application use Redis Device
+``` ruby
require 'logger'
require 'redis_logger_device'
+
dev = RedisLoggerDevice::Base.new
logger = Logger.new(dev)
+
logger.info("AAAAAaaaaaahhhhh")
+
logger.close
+```
---
### Make your Logger Worker in background for process log entries
+``` ruby
require 'logger'
require 'redis_logger_device'
+
include RedisLoggerDevice
+
class SimpleLogWorker < LogWorker
def process_queue!
loop do
begin
@logger.info("LogWorker fetching (#{@queue_name})...")
key, val = @redis.brpop @queue_name
@logger.info("LogWorker rocess key: #{key}; val: #{val}")
+
#your code : val = log entry
+
rescue SignalException => e
raise e
rescue Exception => e
@@ -51,10 +61,14 @@ Or install it yourself as:
end
end
end
+
worker_logger = Logger.new(STDOUT)
worker = SimpleLogWorker.new(worker_logger)
+
worker.process_queue!
+
worker_looger.close
+```
## Contributing

0 comments on commit 61b6a11

Please sign in to comment.