logjam_logger 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2010 David Anderson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README CHANGED
@@ -1,8 +1,12 @@
1
- This gem provides syslog-compatible logging for rails applications. It does so by monkey patching the rails logger.
1
+ This gem provides syslog-compatible logging for rails applications. Just add it to your application and you are good to go -- no other changes are required. (But to really take your logging to the next level, also add time_bandits.)
2
+
3
+ config.gem 'logjam_logger'
2
4
 
3
5
  User ids are logged via a global variable, $user_id. You can use a before_filter in your application_controller to set it, eg:
4
6
 
5
7
  before_filter { |controller| $user_id = controller.session[:user_id] || 0 }
6
8
 
7
- If you wish to change the format of the logged output, you can set LOGJAM_FORMATTER_CLASS to your own formatter before requiring logjam_logger.
9
+ If you wish to change the format of the logged output, you can set LOGJAM_FORMATTER_CLASS to your own formatter after loading the gem. For a simple example, see LogjamLogger::SimpleFormatter in lib/logjam_logger/simple_formatter.rb.
8
10
 
11
+ config.gem 'logjam_logger'
12
+ LOGJAM_FORMATTER_CLASS = MyCustomFormatter
@@ -6,12 +6,12 @@ module LogjamLogger
6
6
 
7
7
  private
8
8
 
9
- # Logging user_ids via a global variable, $user_id.
9
+ # Logging user_ids via a global hash, $user_ids.
10
10
  # You can use a before_filter in your application_controller to set it, eg:
11
11
  #
12
- # before_filter { |controller| $user_id = controller.session[:user_id] || 0 }
12
+ # before_filter { |controller| ($user_ids ||= {})[Thread.current] = controller.session[:user_id] || 0 }
13
13
  def user_id
14
- defined?($user_id) ? " user[#{$user_id}]" : ''
14
+ defined?($user_ids) ? " user[#{$user_ids[Thread.current]}]" : ''
15
15
  end
16
16
 
17
17
  # Note: If you are using FastCGI you may need to hard-code the hostname here instead of using Socket.gethostname
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{logjam_logger}
3
- s.version = "1.0.0"
3
+ s.version = "1.1.0"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["David Anderson"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logjam_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Anderson