ramon 0.3.2 → 0.3.3
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.
- data/lib/ramon.rb +2 -2
- data/lib/ramon/catcher.rb +2 -0
- data/lib/ramon/log_factory.rb +3 -3
- data/lib/ramon/version.rb +1 -1
- data/spec/logger_spec.rb +17 -12
- data/spec/web_spec.rb +6 -0
- metadata +4 -4
data/lib/ramon.rb
CHANGED
data/lib/ramon/catcher.rb
CHANGED
@@ -9,10 +9,12 @@ class Catcher
|
|
9
9
|
|
10
10
|
def handle_with_rack(exception, environment, request)
|
11
11
|
data = RackExceptionData.new(exception, environment, request)
|
12
|
+
Ramon.post('exception', data)
|
12
13
|
end
|
13
14
|
|
14
15
|
def handle(exception, name=nil)
|
15
16
|
data = ExceptionData.new(exception, name)
|
17
|
+
Ramon.post('exception', data)
|
16
18
|
end
|
17
19
|
|
18
20
|
end
|
data/lib/ramon/log_factory.rb
CHANGED
@@ -4,9 +4,9 @@ require 'date'
|
|
4
4
|
module Ramon
|
5
5
|
class Log
|
6
6
|
|
7
|
-
def self.log(message,
|
8
|
-
|
9
|
-
log = {"message" => message, "
|
7
|
+
def self.log(message, tags=nil)
|
8
|
+
tags ||= 'notset'
|
9
|
+
log = {"message" => message, "tags" => tags}
|
10
10
|
|
11
11
|
log
|
12
12
|
end
|
data/lib/ramon/version.rb
CHANGED
data/spec/logger_spec.rb
CHANGED
@@ -3,34 +3,39 @@ require 'spec_helper'
|
|
3
3
|
module Ramon
|
4
4
|
describe Log do
|
5
5
|
|
6
|
-
it "should return a hash with
|
6
|
+
it "should return a hash with tags - debug and message - test" do
|
7
7
|
@log = Log.log('test', 'debug')
|
8
|
-
@log.should == {"
|
8
|
+
@log.should == {"tags" => "debug", "message" => "test"}
|
9
9
|
end
|
10
10
|
|
11
|
-
it "should return a hash with
|
11
|
+
it "should return a hash with tags - info and message - test" do
|
12
12
|
@log = Log.log('test', 'info')
|
13
|
-
@log.should == {"
|
13
|
+
@log.should == {"tags" => "info", "message" => "test"}
|
14
14
|
end
|
15
15
|
|
16
|
-
it "should return a hash with
|
16
|
+
it "should return a hash with tags - notset and message - test" do
|
17
17
|
@log = Log.log('test')
|
18
|
-
@log.should == {"
|
18
|
+
@log.should == {"tags" => "notset", "message" => "test"}
|
19
19
|
end
|
20
20
|
|
21
|
-
it "should return a hash with
|
21
|
+
it "should return a hash with tags - notset and a message hash" do
|
22
22
|
@log = Log.log({:test => "test value", :more => "even more value"})
|
23
|
-
@log.should == {"
|
23
|
+
@log.should == {"tags" => "notset", "message"=>{:more=>"even more value", :test=>"test value"}}
|
24
24
|
end
|
25
25
|
|
26
|
-
it "should return a hash with
|
26
|
+
it "should return a hash with tags - debug and a message hash" do
|
27
27
|
@log = Log.log({:test => "test value", :more => "even more value"},'debug')
|
28
|
-
@log.should == {"
|
28
|
+
@log.should == {"tags" => "debug", "message"=>{:more=>"even more value", :test=>"test value"}}
|
29
29
|
end
|
30
30
|
|
31
|
-
it "should return a hash with
|
31
|
+
it "should return a hash with tags - notset and a message array" do
|
32
32
|
@log = Log.log([1,2,3,4])
|
33
|
-
@log.should == {"
|
33
|
+
@log.should == {"tags" => "notset", "message"=>[1,2,3,4]}
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return an array with tags - debug, benchmark and a message string" do
|
37
|
+
@log = Log.log("test", ["debug", "benchmark"])
|
38
|
+
@log.should == {"tags" => ["debug", "benchmark"], "message"=>"test"}
|
34
39
|
end
|
35
40
|
|
36
41
|
end
|
data/spec/web_spec.rb
CHANGED
@@ -6,8 +6,14 @@ describe 'Web app test' do
|
|
6
6
|
it 'Test logging' do
|
7
7
|
Ramon.log([1,2,3,4]).response.code.should == "200"
|
8
8
|
Ramon.log({:test => 'data', :more_test => 'more_data'}).response.code.should == "200"
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'Test logging with multiple tags' do
|
12
|
+
Ramon.log("test", ['debug', 'benchmark']).response.code.should == "200"
|
13
|
+
Ramon.log({:test => 'data', :more_test => 'more_data'}, ['info','warning','user']).response.code.should == "200"
|
9
14
|
end
|
10
15
|
|
16
|
+
|
11
17
|
it 'Test Exceptions' do
|
12
18
|
Ramon.post('exception', {:url => 'test', :exception_class => 'test_me'}).response.code.should == "200"
|
13
19
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ramon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 3
|
10
|
+
version: 0.3.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- martinrusev
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-01-03 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|