Class: Dploy::Logger
- Inherits:
-
Object
- Object
- Dploy::Logger
- Defined in:
- lib/dploy/logger.rb
Instance Method Summary collapse
- #completion(message, metadata = {}) ⇒ Object
- #debug(message, metadata = {}) ⇒ Object
- #error(message, metadata = {}) ⇒ Object
- #get_messages(start_id = "000000000000000000000000") ⇒ Object
-
#initialize(mongo_host, deploy_id) ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize(mongo_host, deploy_id) ⇒ Logger
Returns a new instance of Logger.
7 8 9 |
# File 'lib/dploy/logger.rb', line 7 def initialize(mongo_host, deploy_id) @log = Mongo::Connection.new(mongo_host).db('log')[deploy_id] end |
Instance Method Details
#completion(message, metadata = {}) ⇒ Object
21 22 23 24 |
# File 'lib/dploy/logger.rb', line 21 def completion(, = {}) = .merge({:log_type => 'completion' }) log(, ) end |
#debug(message, metadata = {}) ⇒ Object
11 12 13 14 |
# File 'lib/dploy/logger.rb', line 11 def debug(, = {}) = .merge({:log_type => 'debug' }) log(, ) end |
#error(message, metadata = {}) ⇒ Object
16 17 18 19 |
# File 'lib/dploy/logger.rb', line 16 def error(, = {}) = .merge({:log_type => 'error' }) log(, ) end |
#get_messages(start_id = "000000000000000000000000") ⇒ Object
26 27 28 |
# File 'lib/dploy/logger.rb', line 26 def (start_id = "000000000000000000000000") @log.find(:_id => {"$gt" => BSON::ObjectId(start_id)}).map {|row| row} end |