Class: Palmade::Tapsilog::Adapters::MongoAdapter
- Inherits:
-
BaseAdapter
- Object
- BaseAdapter
- Palmade::Tapsilog::Adapters::MongoAdapter
show all
- Defined in:
- lib/palmade/tapsilog/adapters/mongo_adapter.rb
Instance Method Summary
collapse
Methods inherited from BaseAdapter
#flush, #initialize
Instance Method Details
#close ⇒ Object
17
18
19
20
21
|
# File 'lib/palmade/tapsilog/adapters/mongo_adapter.rb', line 17
def close
unless @conn.nil?
@conn.close if @conn.connected?
end
end
|
#write(log_message) ⇒ Object
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/palmade/tapsilog/adapters/mongo_adapter.rb', line 6
def write(log_message)
service = log_message[1].to_s
coll = get_collection(service)
if coll
coll.insert(log_to_hash(log_message))
else
STDERR.puts "Unknown service: #{service}"
end
end
|