logjam_agent 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,9 +6,10 @@ module LogjamAgent
|
|
6
6
|
def initialize
|
7
7
|
@hostname = Socket.gethostname.split('.').first
|
8
8
|
@app_name = "rails"
|
9
|
+
@attributes = []
|
9
10
|
end
|
10
11
|
|
11
|
-
attr_accessor :
|
12
|
+
attr_accessor :attributes
|
12
13
|
|
13
14
|
SEV_LABEL = Logger::SEV_LABEL.map{|sev| "%-5s" % sev}
|
14
15
|
|
@@ -25,15 +26,19 @@ module LogjamAgent
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def call(severity, timestamp, progname, msg)
|
28
|
-
"#{format_severity(severity)} #{format_time(timestamp)} #{@hostname} #{progname||@app_name}[#{$$}]#{
|
29
|
+
"#{format_severity(severity)} #{format_time(timestamp)} #{@hostname} #{progname||@app_name}[#{$$}]#{render_attributes}: #{format_message(msg)}"
|
29
30
|
end
|
30
31
|
|
31
|
-
def
|
32
|
-
|
32
|
+
def render_attributes
|
33
|
+
@attributes.map{|key, value| " #{key}[#{value}]"}.join
|
33
34
|
end
|
34
35
|
|
35
|
-
def
|
36
|
-
|
36
|
+
def set_attribute(name, value)
|
37
|
+
if attribute = @attributes.detect{|n,v| n == name}
|
38
|
+
attribute[1] = value
|
39
|
+
else
|
40
|
+
@attributes << [name, value]
|
41
|
+
end
|
37
42
|
end
|
38
43
|
end
|
39
44
|
end
|
data/lib/logjam_agent/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logjam_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Stefan Kaes
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-10-06 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|