logjam_agent 0.1.1 → 0.1.2
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.
@@ -34,15 +34,12 @@ module LogjamAgent
|
|
34
34
|
def add(severity, message = nil, progname = nil, &block)
|
35
35
|
return if @level > severity
|
36
36
|
message = (message || (block && block.call) || '').to_s
|
37
|
-
# If a newline is necessary then create a new message ending with a newline.
|
38
|
-
# Ensures that the original message is not mutated.
|
39
|
-
message = "#{message}\n" unless message[-1] == ?\n
|
40
37
|
time = Time.now
|
41
|
-
buffer << formatter.call(severity, time, progname, message)
|
38
|
+
buffer << formatter.call(severity, time, progname, message) << "\n"
|
42
39
|
auto_flush
|
43
40
|
if request = self.request
|
44
41
|
# puts "adding line to request"
|
45
|
-
request.add_line(severity, time, message
|
42
|
+
request.add_line(severity, time, message)
|
46
43
|
end
|
47
44
|
message
|
48
45
|
end
|
@@ -20,20 +20,20 @@ module LogjamAgent
|
|
20
20
|
timestamp.strftime("%b %d %H:%M:%S.#{timestamp.usec}")
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
24
|
-
|
23
|
+
def format_message(msg)
|
24
|
+
msg.strip
|
25
25
|
end
|
26
26
|
|
27
27
|
def call(severity, timestamp, progname, msg)
|
28
|
-
"#{format_severity(severity)} #{format_time(timestamp)} #{@hostname} #{progname||@app_name}[#{$$}]#{render_extra_attributes}: #{
|
28
|
+
"#{format_severity(severity)} #{format_time(timestamp)} #{@hostname} #{progname||@app_name}[#{$$}]#{render_extra_attributes}: #{format_message(msg)}"
|
29
29
|
end
|
30
30
|
|
31
31
|
def render_extra_attributes
|
32
|
-
(
|
32
|
+
(@extra_attributes || []).map{|key, value| " #{key}[#{value}]"}.join
|
33
33
|
end
|
34
34
|
|
35
35
|
def add_extra_attributes(attributes)
|
36
|
-
(
|
36
|
+
(@extra_attributes ||= []).concat(attributes)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
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: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
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-09-
|
18
|
+
date: 2011-09-05 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|