batlog 0.9 → 0.9.1

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/.gitignore CHANGED
@@ -1 +1,2 @@
1
- .idea
1
+ .idea
2
+ *.gem
@@ -0,0 +1,14 @@
1
+
2
+ ### 0.9.1 - bug fixes
3
+ * BUGFIX - post a message without context
4
+ ### 0.9 - Initial Release
5
+ * Basic Functionality
6
+ * Log.info,warn,debug,error,fatal
7
+ * Log.assert
8
+ * Log.context
9
+ * Log.events
10
+ * 3 Loggers
11
+ * Database logger
12
+ * Rails logger
13
+ * Exceptional logger
14
+ * Log::ControllerSupport
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- batlog (0.9)
4
+ batlog (0.9.01)
5
5
  rails
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,8 +1,12 @@
1
- # BatLog v0.9
1
+ # BatLog v0.9.1 [![Build Status](https://secure.travis-ci.org/TheGiftsProject/batlog.png)](http://travis-ci.org/TheGiftsProject/batlog)
2
2
  ![batlog-logo](https://dl.dropbox.com/u/7525692/batlog-withtext.png "BatLog")
3
3
 
4
4
  ## Setup
5
- To install BatLog into your Rails app just run `rails generate db_log` to create the db_log's table migration.
5
+ To install BatLog into your Rails app just the gem to your Gemfile
6
+ ```ruby
7
+ gem 'batlog'
8
+ ```
9
+ After that run `rails generate db_log` to create the db_log's table migration.
6
10
  By default BatLog writes to three places - the database, the rails logger and exceptions to exceptional
7
11
  You can overide this behaivour by providing your own loggers or changing the default logger in the configuration.
8
12
 
@@ -102,7 +106,7 @@ all subsequent loggers.
102
106
 
103
107
 
104
108
  ### Controller Support
105
- Also included with BatLog is the log controller support to use it we recommend you add it to your ApplicationController
109
+ Also included with BatLog is the log controller support. To use it we recommend you add it to your ApplicationController
106
110
  by adding these lines to it.
107
111
  ```ruby
108
112
  require 'log/controller_support'
@@ -24,6 +24,7 @@ module Log
24
24
  SEVERITIES.each_key do |severity|
25
25
  (class << self; self; end).send(:define_method, severity.to_s) do |*args|
26
26
  message, ctx = *args
27
+ ctx ||= {}
27
28
  ctx = context.merge(ctx)
28
29
  self.write(severity, message, ctx)
29
30
  end
@@ -1,3 +1,3 @@
1
1
  module Log
2
- VERSION = 0.9
2
+ VERSION = "0.9.1"
3
3
  end
@@ -17,7 +17,33 @@ describe Log do
17
17
  subject.clear_events
18
18
  end
19
19
 
20
+ describe "basics" do
21
+
22
+ before do
23
+ Log.config.loggers = [ Log::TestLogger ]
24
+ Log::TestLogger.reset
25
+ end
26
+
27
+ it "should be able to write a message without a context" do
28
+ Log.info("test")
29
+ Log::TestLogger.logs.count.should == 1
30
+ end
31
+
32
+ it "should be able to write a message with a context" do
33
+ Log.info("test", :a => 1)
34
+ Log::TestLogger.logs.count.should == 1
35
+ end
36
+
37
+ it "should be able to write a message with a context and an event" do
38
+ Log.info("test", {:a => 1}, [{:name => 1, :data => 2}])
39
+ Log::TestLogger.logs.count.should == 1
40
+ end
41
+
42
+ end
43
+
20
44
  describe "log.writes" do
45
+
46
+
21
47
  shared_examples_for "log severity" do |severity|
22
48
  context "when message is a LoggableError" do
23
49
  it "adds the log data to the context" do
@@ -2,6 +2,8 @@ require 'rubygems'
2
2
  require 'bundler/setup'
3
3
  require 'batlog'
4
4
 
5
+ require 'spec_helpers/test_logger'
6
+
5
7
 
6
8
  RSpec.configure do |config|
7
9
  config.treat_symbols_as_metadata_keys_with_true_values = true
@@ -0,0 +1,20 @@
1
+ module Log
2
+ class TestLogger
3
+
4
+ LogMessage = Struct.new(:severity, :message, :context, :events, :metadata)
5
+
6
+ def self.log(severity, message, context, events, metadata)
7
+ logs << LogMessage.new(severity, message, context, events, metadata)
8
+ end
9
+
10
+ def self.logs
11
+ @logs ||= reset
12
+ end
13
+
14
+ def self.reset
15
+ @logs = []
16
+ end
17
+
18
+ end
19
+
20
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: batlog
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 57
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- version: "0.9"
9
+ - 1
10
+ version: 0.9.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Asaf Gartner
@@ -73,6 +74,7 @@ files:
73
74
  - .rspec
74
75
  - .rvmrc
75
76
  - .travis.yml
77
+ - CHANGELOG.md
76
78
  - Gemfile
77
79
  - Gemfile.lock
78
80
  - README.md
@@ -96,6 +98,7 @@ files:
96
98
  - spec/lib/log_spec.rb
97
99
  - spec/lib/loggable_error_spec.rb
98
100
  - spec/spec_helper.rb
101
+ - spec/spec_helpers/test_logger.rb
99
102
  homepage: https://github.com/TheGiftsProject/batlog
100
103
  licenses: []
101
104