ramon 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,8 +15,8 @@ require_local 'railtie' if defined?(Rails)
15
15
 
16
16
  module Ramon
17
17
 
18
- def self.log(message, level=nil)
19
- log_hash = Log.log(message, level)
18
+ def self.log(message, tags=nil)
19
+ log_hash = Log.log(message, tags)
20
20
  Remote.post('log', log_hash)
21
21
  end
22
22
 
@@ -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
@@ -4,9 +4,9 @@ require 'date'
4
4
  module Ramon
5
5
  class Log
6
6
 
7
- def self.log(message, level=nil)
8
- level ||= 'notset'
9
- log = {"message" => message, "level" => level}
7
+ def self.log(message, tags=nil)
8
+ tags ||= 'notset'
9
+ log = {"message" => message, "tags" => tags}
10
10
 
11
11
  log
12
12
  end
@@ -1,3 +1,3 @@
1
1
  module Ramon
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
@@ -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 level - debug and message - test" do
6
+ it "should return a hash with tags - debug and message - test" do
7
7
  @log = Log.log('test', 'debug')
8
- @log.should == {"level" => "debug", "message" => "test"}
8
+ @log.should == {"tags" => "debug", "message" => "test"}
9
9
  end
10
10
 
11
- it "should return a hash with level - info and message - test" do
11
+ it "should return a hash with tags - info and message - test" do
12
12
  @log = Log.log('test', 'info')
13
- @log.should == {"level" => "info", "message" => "test"}
13
+ @log.should == {"tags" => "info", "message" => "test"}
14
14
  end
15
15
 
16
- it "should return a hash with level - notset and message - test" do
16
+ it "should return a hash with tags - notset and message - test" do
17
17
  @log = Log.log('test')
18
- @log.should == {"level" => "notset", "message" => "test"}
18
+ @log.should == {"tags" => "notset", "message" => "test"}
19
19
  end
20
20
 
21
- it "should return a hash with level - notset and a message hash" do
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 == {"level" => "notset", "message"=>{:more=>"even more value", :test=>"test value"}}
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 level - debug and a message hash" do
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 == {"level" => "debug", "message"=>{:more=>"even more value", :test=>"test value"}}
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 level - notset and a message array" do
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 == {"level" => "notset", "message"=>[1,2,3,4]}
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
@@ -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: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 2
10
- version: 0.3.2
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: 2011-12-09 00:00:00 +00:00
18
+ date: 2012-01-03 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency