leviathan-rails 0.0.2.alpha → 0.0.3.alpha
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/leviathan-rails.rb +9 -0
- metadata +1 -1
data/lib/leviathan-rails.rb
CHANGED
@@ -7,6 +7,13 @@ require 'activesupport_notifications_backport'
|
|
7
7
|
APP_ROOT = File.dirname(__FILE__)
|
8
8
|
|
9
9
|
module Leviathan
|
10
|
+
class SqlLogSubscriber < ActiveSupport::LogSubscriber
|
11
|
+
def sql(event)
|
12
|
+
message = event.payload,to_msgpack
|
13
|
+
UDPSocket.new.send message, 0, Leviathon::connection[:port], Leviathan::connection[:port]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
10
17
|
def self.connection
|
11
18
|
@connection
|
12
19
|
end
|
@@ -25,6 +32,8 @@ module Leviathan
|
|
25
32
|
Leviathan::notify(connection, args)
|
26
33
|
end
|
27
34
|
end
|
35
|
+
|
36
|
+
SqlLogSubscriber.attach_to :active_record
|
28
37
|
end
|
29
38
|
|
30
39
|
def self.notify(connection, args)
|