grizzled-rails-logger 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +12 -0
- data/grizzled-rails-logger.gemspec +2 -2
- data/lib/grizzled/rails/logger.rb +39 -11
- data/rdoc/Grizzled/Rails/Logger.html +1 -1
- data/rdoc/created.rid +2 -2
- data/rdoc/lib/grizzled/rails/logger_rb.html +1 -1
- metadata +10 -5
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
Version 0.1.5
|
4
|
+
|
5
|
+
- Changed to work with Rails 3.2.6, while retaining backward compatibility
|
6
|
+
with prior versions. Addresses [Issue #5][].
|
7
|
+
- Added a `dont_flatten_patterns` configuration item. See the
|
8
|
+
[documentation](http://software.clapper.org/grizzled-rails-logger/) for
|
9
|
+
details.
|
10
|
+
|
11
|
+
[Issue #5]: https://github.com/bmc/grizzled-rails-logger/issues/5
|
12
|
+
|
13
|
+
---
|
14
|
+
|
3
15
|
Version 0.1.4
|
4
16
|
|
5
17
|
Before attempting to use (and `gsub` against) the passed-in message, the
|
@@ -17,13 +17,15 @@ module Grizzled # :nodoc:
|
|
17
17
|
|
18
18
|
# Configuration constants
|
19
19
|
Configuration = OpenStruct.new(
|
20
|
-
:format
|
21
|
-
:timeformat
|
22
|
-
:colorize
|
23
|
-
:flatten
|
24
|
-
:flatten_patterns
|
20
|
+
:format => '[%T] (%S) %P %M',
|
21
|
+
:timeformat => '%Y/%m/%d %H:%M:%S',
|
22
|
+
:colorize => true,
|
23
|
+
:flatten => true,
|
24
|
+
:flatten_patterns => [
|
25
25
|
/.*/
|
26
26
|
],
|
27
|
+
:dont_flatten_patterns => [
|
28
|
+
],
|
27
29
|
:colors => {
|
28
30
|
:debug => Term::ANSIColor.cyan,
|
29
31
|
:warn => Term::ANSIColor.yellow + Term::ANSIColor.bold,
|
@@ -92,11 +94,19 @@ Backtrace:
|
|
92
94
|
private
|
93
95
|
|
94
96
|
def do_add(severity, message, progname, options = {}, &block)
|
95
|
-
|
97
|
+
if self.respond_to? :level
|
98
|
+
lvl = level
|
99
|
+
elsif defined? @level
|
100
|
+
lvl = @level
|
101
|
+
else
|
102
|
+
raise "Can't determine logging level."
|
103
|
+
end
|
104
|
+
|
105
|
+
return if lvl > severity
|
96
106
|
|
97
107
|
if message.nil?
|
98
108
|
if block_given?
|
99
|
-
if severity <
|
109
|
+
if severity < lvl
|
100
110
|
return true
|
101
111
|
end
|
102
112
|
message = yield
|
@@ -105,17 +115,35 @@ Backtrace:
|
|
105
115
|
|
106
116
|
flatten = options.fetch(:flatten, Configuration.flatten)
|
107
117
|
if flatten
|
108
|
-
|
118
|
+
flatten_patterns = options.fetch(
|
109
119
|
:flatten_patterns, Configuration.flatten_patterns
|
110
120
|
)
|
111
|
-
|
121
|
+
dont_flatten_patterns = options.fetch(
|
122
|
+
:dont_flatten_patterns, Configuration.dont_flatten_patterns
|
123
|
+
)
|
124
|
+
if flatten_patterns.nil? || (flatten_patterns.length == 0)
|
125
|
+
flatten_patterns = ['.*']
|
126
|
+
end
|
127
|
+
flatten = false
|
112
128
|
flattened_message = message.to_s.gsub("\n", '')
|
113
|
-
|
129
|
+
|
130
|
+
# Flatten the message if it matches the specified pattern...
|
131
|
+
flatten_patterns.each do |pattern|
|
114
132
|
if pattern =~ flattened_message
|
115
|
-
|
133
|
+
flatten = true
|
116
134
|
break
|
117
135
|
end
|
118
136
|
end
|
137
|
+
|
138
|
+
# ... unless it's also matches a "don't flatten" pattern.
|
139
|
+
dont_flatten_patterns.each do |pattern|
|
140
|
+
if pattern =~ flattened_message
|
141
|
+
flatten = false
|
142
|
+
break
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
message = flattened_message if flatten
|
119
147
|
end
|
120
148
|
|
121
149
|
time = Time.now.strftime(Configuration.timeformat)
|
@@ -175,7 +175,7 @@ end</pre>
|
|
175
175
|
|
176
176
|
<div class="method-source-code" id="configure-source">
|
177
177
|
<pre>
|
178
|
-
<span class="ruby-comment"># File lib/grizzled/rails/logger.rb, line
|
178
|
+
<span class="ruby-comment"># File lib/grizzled/rails/logger.rb, line 43</span>
|
179
179
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">configure</span>(&<span class="ruby-identifier">block</span>)
|
180
180
|
<span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span> <span class="ruby-constant">Configuration</span>
|
181
181
|
<span class="ruby-keyword">end</span></pre>
|
data/rdoc/created.rid
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Sat,
|
1
|
+
Sat, 16 Jun 2012 13:38:51 -0400
|
2
2
|
lib/grizzled/rails.rb Thu, 12 Apr 2012 11:47:09 -0400
|
3
|
-
lib/grizzled/rails/logger.rb Sat,
|
3
|
+
lib/grizzled/rails/logger.rb Sat, 16 Jun 2012 13:38:37 -0400
|
4
4
|
lib/grizzled.rb Thu, 12 Apr 2012 11:46:52 -0400
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grizzled-rails-logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: term-ansicolor
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,12 @@ dependencies:
|
|
21
21
|
version: 1.0.7
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.0.7
|
25
30
|
description: ! 'A custom Rails 3 logger
|
26
31
|
|
27
32
|
'
|
@@ -94,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
99
|
version: '0'
|
95
100
|
requirements: []
|
96
101
|
rubyforge_project:
|
97
|
-
rubygems_version: 1.8.
|
102
|
+
rubygems_version: 1.8.24
|
98
103
|
signing_key:
|
99
104
|
specification_version: 3
|
100
105
|
summary: A custom Rails 3 logger
|