catamaran 2.6.0 → 2.7.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.
- checksums.yaml +5 -13
- data/README.md +2 -2
- data/lib/catamaran/formatter.rb +9 -9
- data/lib/catamaran/version.rb +1 -1
- data/spec/formatter_spec.rb +13 -13
- metadata +11 -11
checksums.yaml
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
|
|
5
|
-
data.tar.gz: !binary |-
|
|
6
|
-
NTg0ZTQ2ZThkMWIzY2NkOTMwYmQwOWQ1ZDUxNmE0ZDU4ZWJlYThmMQ==
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 5ec5fad576b16ec643dff53a6c7d5428f2bb7a2c
|
|
4
|
+
data.tar.gz: bfadf619612c9bc922c863ce4c7c3293944b11af
|
|
7
5
|
SHA512:
|
|
8
|
-
metadata.gz:
|
|
9
|
-
|
|
10
|
-
YjdlNjU4NTM5YmJjMjMwNTJmZGExNTE0MjRhNTAyYmY5ZTA5ZDhlMmYyOGQz
|
|
11
|
-
ZjVjZDIyOTBhM2Y0ODQxYzZmYWUwZDdiNzhhNGE1YjgyOWQ5ZmQ=
|
|
12
|
-
data.tar.gz: !binary |-
|
|
13
|
-
YzYyZTFkMWM4YTEwMjY5Yjk0ZTAyM2ZjZDYyOGJmNjg1YTMyYzcxNzdmNzUw
|
|
14
|
-
NWJmZjFlYzRjMTUyZDJkMWNmNTk4ZWE0YzNlMzlhMzE2ODIyMTVlZjU5YThl
|
|
15
|
-
NDRmMGM1ZDRiYzI3ZmY4YTU2NTc4NzgxMWYxNTQ4MTAyODdjZGY=
|
|
6
|
+
metadata.gz: 6118b18e89b3c4eb21edb2f124f66df786735d5d4dc46c1481a2730119d78d86e869e32255a701f64724f0043d1800e7497b03d2386166ec07e1dd09f3ef6e4b
|
|
7
|
+
data.tar.gz: a41e659df3ada791193bd1165428d9c1a7f08df9eb731033efd5b15d50a8b3938025ad9ccda10a91ac919fb3f2ae3a0565503552d78cf2f72f7f22e403965688
|
data/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Catamaran was built around a named hierarchy and level inheritance, and with per
|
|
|
9
9
|
Gemfile
|
|
10
10
|
-------
|
|
11
11
|
|
|
12
|
-
gem 'catamaran', '~> 2.
|
|
12
|
+
gem 'catamaran', '~> 2.7.0'
|
|
13
13
|
|
|
14
14
|
Rails-related setup:
|
|
15
15
|
|
|
@@ -212,7 +212,7 @@ LOGGER.notice "This is a NOTICE log"
|
|
|
212
212
|
LOGGER.warn "This is a WARN log"
|
|
213
213
|
LOGGER.error "This is a ERROR log"
|
|
214
214
|
LOGGER.severe "This is a SEVERE log"
|
|
215
|
-
LOGGER.
|
|
215
|
+
LOGGER.fatal "This is a FATAL log"
|
|
216
216
|
```
|
|
217
217
|
|
|
218
218
|
### Performance implications of using `caller`
|
data/lib/catamaran/formatter.rb
CHANGED
|
@@ -119,27 +119,27 @@ module Catamaran
|
|
|
119
119
|
protected
|
|
120
120
|
|
|
121
121
|
def self.construct_favorite_pattern_number_1( severity, path, msg, opts )
|
|
122
|
-
sprintf( "%6s pid-#{Process.pid} [#{DateTime.now.iso8601}] %47s
|
|
122
|
+
sprintf( "%6s pid-#{Process.pid} [#{DateTime.now.iso8601}] %47s",
|
|
123
123
|
LogLevel.severity_to_s( severity ),
|
|
124
|
-
( path.length > 47 ) ? path.dup[-47,47] : path
|
|
124
|
+
( path.length > 47 ) ? path.dup[-47,47] : path ) + " - #{msg}"
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
def self.construct_favorite_pattern_number_2( severity, path, msg, opts )
|
|
128
|
-
sprintf( "%6s pid-#{Process.pid} [#{Time.now.to_s}] %s
|
|
128
|
+
sprintf( "%6s pid-#{Process.pid} [#{Time.now.to_s}] %s",
|
|
129
129
|
LogLevel.severity_to_s( severity ),
|
|
130
|
-
path )
|
|
130
|
+
path ) + " - #{msg}"
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
def self.construct_favorite_pattern_number_3( severity, path, msg, opts )
|
|
134
|
-
sprintf( "%6s pid-#{Process.pid} [#{Time.now.gmtime.strftime( "%Y-%m-%dT%H:%M:%S.%LZ" )}] %47s
|
|
134
|
+
sprintf( "%6s pid-#{Process.pid} [#{Time.now.gmtime.strftime( "%Y-%m-%dT%H:%M:%S.%LZ" )}] %47s",
|
|
135
135
|
LogLevel.severity_to_s( severity ),
|
|
136
|
-
( path.length > 47 ) ? path.dup[-47,47] : path )
|
|
136
|
+
( path.length > 47 ) ? path.dup[-47,47] : path ) + " - #{msg}"
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
def self.construct_favorite_pattern_number_4( severity, path, msg, opts )
|
|
140
|
-
sprintf( "%6s pid-#{Process.pid} [#{Time.now.strftime( "%Y-%m-%d %H:%M:%S:%L" )}] %47s
|
|
140
|
+
sprintf( "%6s pid-#{Process.pid} [#{Time.now.strftime( "%Y-%m-%d %H:%M:%S:%L" )}] %47s",
|
|
141
141
|
LogLevel.severity_to_s( severity ),
|
|
142
|
-
( path.length > 47 ) ? path.dup[-47,47] : path )
|
|
142
|
+
( path.length > 47 ) ? path.dup[-47,47] : path ) + " - #{msg}"
|
|
143
143
|
end
|
|
144
144
|
|
|
145
145
|
|
|
@@ -158,4 +158,4 @@ module Catamaran
|
|
|
158
158
|
end
|
|
159
159
|
|
|
160
160
|
end
|
|
161
|
-
end
|
|
161
|
+
end
|
data/lib/catamaran/version.rb
CHANGED
data/spec/formatter_spec.rb
CHANGED
|
@@ -5,14 +5,14 @@ describe Catamaran::Formatter do
|
|
|
5
5
|
|
|
6
6
|
let(:severity){ 7000 }
|
|
7
7
|
let(:path){ '/douglas/adams' }
|
|
8
|
-
let(:log_message){ "Don't
|
|
8
|
+
let(:log_message){ "Don't panic. The best #!%%&$* car is now 50% off" }
|
|
9
9
|
|
|
10
10
|
context "when using a custom format pattern" do
|
|
11
11
|
context "with no options" do
|
|
12
12
|
let(:pattern) { "%c (%d) %p PID: %P | %m" }
|
|
13
13
|
it "outputs the custom format" do
|
|
14
14
|
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, :pattern => pattern)
|
|
15
|
-
message.should match /^\s+ERROR\s\(.*\)\s#{path}\sPID:\s\d+\s\|\s#{log_message}$/
|
|
15
|
+
message.should match /^\s+ERROR\s\(.*\)\s#{path}\sPID:\s\d+\s\|\s#{Regexp.escape(log_message)}$/
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
end
|
|
@@ -21,13 +21,13 @@ describe Catamaran::Formatter do
|
|
|
21
21
|
it "should make use of Manager.formatter_pattern" do
|
|
22
22
|
Catamaran::Manager::formatter_pattern = "%c pid-%P [%d] %p - %m"
|
|
23
23
|
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, {} )
|
|
24
|
-
message.should match /^\s+ERROR\spid\-\d+\s\[.*\]\s#{path}\s\-\s#{log_message}$/
|
|
24
|
+
message.should match /^\s+ERROR\spid\-\d+\s\[.*\]\s#{path}\s\-\s#{Regexp.escape(log_message)}$/
|
|
25
25
|
|
|
26
26
|
Catamaran::Manager.reset
|
|
27
27
|
|
|
28
28
|
Catamaran::Manager::formatter_pattern = "%-6p pid-%pid [%d{yyyy-MM-dd HH:mm:ss.SSS}] %47C - %m"
|
|
29
29
|
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, {} )
|
|
30
|
-
message.should match /^\s+ERROR\spid\-\d+\s\[.*\]\s\s\s\s\s\s\s\s\s\s\s+#{path}\s\-\s#{log_message}$/
|
|
30
|
+
message.should match /^\s+ERROR\spid\-\d+\s\[.*\]\s\s\s\s\s\s\s\s\s\s\s+#{path}\s\-\s#{Regexp.escape(log_message)}$/
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
|
|
@@ -35,7 +35,7 @@ describe Catamaran::Formatter do
|
|
|
35
35
|
context "with no options" do
|
|
36
36
|
it "outputs the default format of %-6p pid-%pid [%d{yyyy-M-d HH:mm:ss:SSS}] %47C - %m" do
|
|
37
37
|
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, {} )
|
|
38
|
-
message.should match /^\s+ERROR\spid\-\d+\s\[.*\]\s+#{path}\s\-\s#{log_message}$/
|
|
38
|
+
message.should match /^\s+ERROR\spid\-\d+\s\[.*\]\s+#{path}\s\-\s#{Regexp.escape(log_message)}$/
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
@@ -44,7 +44,7 @@ describe Catamaran::Formatter do
|
|
|
44
44
|
|
|
45
45
|
it "outputs the default format with extra information" do
|
|
46
46
|
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, opts)
|
|
47
|
-
message.should match /#{log_message}\s\(#{opts[:file]}:#{opts[:line]}:in \`#{opts[:class]}\.#{opts[:method]}\'\)$/
|
|
47
|
+
message.should match /#{Regexp.escape(log_message)}\s\(#{opts[:file]}:#{opts[:line]}:in \`#{opts[:class]}\.#{opts[:method]}\'\)$/
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
|
|
@@ -54,32 +54,32 @@ describe Catamaran::Formatter do
|
|
|
54
54
|
it "no file, outputs the default format without extra information" do
|
|
55
55
|
opts.delete :file
|
|
56
56
|
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, opts)
|
|
57
|
-
message.should match /^\s+ERROR\spid\-\d+\s\[.*\]\s+#{path}\s\-\s#{log_message}$/
|
|
57
|
+
message.should match /^\s+ERROR\spid\-\d+\s\[.*\]\s+#{path}\s\-\s#{Regexp.escape(log_message)}$/
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
it "no line number, outputs extra information without the line number" do
|
|
61
61
|
opts.delete :line
|
|
62
62
|
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, opts)
|
|
63
|
-
message.should match /#{log_message}\s\(#{opts[:file]}:in \`#{opts[:class]}\.#{opts[:method]}\'\)$/
|
|
63
|
+
message.should match /#{Regexp.escape(log_message)}\s\(#{opts[:file]}:in \`#{opts[:class]}\.#{opts[:method]}\'\)$/
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
it "no class, outputs extra information without the class" do
|
|
67
67
|
opts.delete :class
|
|
68
68
|
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, opts)
|
|
69
|
-
message.should match /#{log_message}\s\(#{opts[:file]}:#{opts[:line]}:in \`#{opts[:method]}\'\)$/
|
|
69
|
+
message.should match /#{Regexp.escape(log_message)}\s\(#{opts[:file]}:#{opts[:line]}:in \`#{opts[:method]}\'\)$/
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
it "no method, outputs extra information without the method" do
|
|
73
73
|
opts.delete :method
|
|
74
74
|
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, opts)
|
|
75
|
-
message.should match /#{log_message}\s\(#{opts[:file]}:#{opts[:line]}:in \`#{opts[:class]}\.'\)$/
|
|
75
|
+
message.should match /#{Regexp.escape(log_message)}\s\(#{opts[:file]}:#{opts[:line]}:in \`#{opts[:class]}\.'\)$/
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
it "no class and no method, extra information without the class and method" do
|
|
79
79
|
opts.delete :method
|
|
80
80
|
opts.delete :class
|
|
81
81
|
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, opts)
|
|
82
|
-
message.should match /#{log_message}\s\(#{opts[:file]}:#{opts[:line]}\)$/
|
|
82
|
+
message.should match /#{Regexp.escape(log_message)}\s\(#{opts[:file]}:#{opts[:line]}\)$/
|
|
83
83
|
end
|
|
84
84
|
end
|
|
85
85
|
|
|
@@ -87,7 +87,7 @@ describe Catamaran::Formatter do
|
|
|
87
87
|
it "outputs the default format with derived caller information" do
|
|
88
88
|
Catamaran::Formatter.caller_enabled = true
|
|
89
89
|
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, {} )
|
|
90
|
-
message.should match /#{log_message}\s\(.*\)/
|
|
90
|
+
message.should match /#{Regexp.escape(log_message)}\s\(.*\)/
|
|
91
91
|
end
|
|
92
92
|
end
|
|
93
93
|
|
|
@@ -96,7 +96,7 @@ describe Catamaran::Formatter do
|
|
|
96
96
|
|
|
97
97
|
it "outputs the default format with a backtrace" do
|
|
98
98
|
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, opts)
|
|
99
|
-
message.should match /#{log_message}\sfrom:\n.+/
|
|
99
|
+
message.should match /#{Regexp.escape(log_message)}\sfrom:\n.+/
|
|
100
100
|
end
|
|
101
101
|
end
|
|
102
102
|
end
|
metadata
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: catamaran
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeano
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-12-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- -
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '0'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- -
|
|
24
|
+
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rspec
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- -
|
|
31
|
+
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
33
|
version: '0'
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- -
|
|
38
|
+
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '0'
|
|
41
41
|
description: A logging utility
|
|
@@ -45,8 +45,8 @@ executables: []
|
|
|
45
45
|
extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
|
47
47
|
files:
|
|
48
|
-
- .gitignore
|
|
49
|
-
- .travis.yml
|
|
48
|
+
- ".gitignore"
|
|
49
|
+
- ".travis.yml"
|
|
50
50
|
- Gemfile
|
|
51
51
|
- LICENSE
|
|
52
52
|
- README.md
|
|
@@ -88,17 +88,17 @@ require_paths:
|
|
|
88
88
|
- lib
|
|
89
89
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
90
|
requirements:
|
|
91
|
-
- -
|
|
91
|
+
- - ">="
|
|
92
92
|
- !ruby/object:Gem::Version
|
|
93
93
|
version: '0'
|
|
94
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
requirements:
|
|
96
|
-
- -
|
|
96
|
+
- - ">="
|
|
97
97
|
- !ruby/object:Gem::Version
|
|
98
98
|
version: '0'
|
|
99
99
|
requirements: []
|
|
100
100
|
rubyforge_project:
|
|
101
|
-
rubygems_version: 2.2.
|
|
101
|
+
rubygems_version: 2.2.2
|
|
102
102
|
signing_key:
|
|
103
103
|
specification_version: 4
|
|
104
104
|
summary: Catamaran Logger
|