logjam_logger 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.markdown +38 -0
  2. data/logjam_logger.gemspec +2 -2
  3. metadata +2 -2
  4. data/README +0 -12
data/README.markdown ADDED
@@ -0,0 +1,38 @@
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](http://github.com/skaes/time_bandits).)
2
+
3
+ Standard rails log:
4
+
5
+ Completed in 775ms (View: 158, DB: 79) | 200 OK ...
6
+
7
+ With logjam_logger, including optional user_id:
8
+
9
+ Dec 18 17:36:17 elk rails[13902] user[10]: Completed in 775ms (View: 158, DB: 79) | 200 OK ...
10
+
11
+ Logjam_logger plus time bandits, including memcache, gc, and heap statistics:
12
+
13
+ Dec 18 17:36:17 elk rails[23914] user[10]: Completed in 775.170ms (View: 157.536, DB: 78.723(20,2), MC: 0.000(0r,0m), GC: 63.514(1), HP: 0(450818,157437,5412650)) | 200 OK ...
14
+
15
+ ## Installation
16
+
17
+ config.gem 'logjam_logger'
18
+
19
+ ## User ids
20
+
21
+ User ids can be logged via a global hash, $user_ids. You can use a before_filter in your application_controller to set it, eg:
22
+
23
+ before_filter { |controller| ($user_ids ||= {})[Thread.current] = controller.session[:user_id] || 0 }
24
+
25
+ This is optional -- if $user_ids is undefined, that part of the log line will be left out.
26
+
27
+ ## Custom formatting
28
+
29
+ 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.
30
+
31
+ config.gem 'logjam_logger'
32
+ LOGJAM_FORMATTER_CLASS = MyCustomFormatter
33
+
34
+ For example, you might want to extend LogjamLogger::Formatter to also include the session_id.
35
+
36
+ ## Log file analysis
37
+
38
+ logjam_logger was written to work well with [Logjam](http://github.com/alpinegizmo/logjam).
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{logjam_logger}
3
- s.version = "1.1.0"
3
+ s.version = "1.1.1"
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"]
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.email = %q{david@alpinegizmo.com}
10
10
  s.files = [
11
11
  "LICENSE",
12
- "README",
12
+ "README.markdown",
13
13
  "logjam_logger.gemspec",
14
14
  "lib/logjam_logger.rb",
15
15
  "lib/logjam_logger/buffer.rb",
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.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Anderson
@@ -23,7 +23,7 @@ extra_rdoc_files: []
23
23
 
24
24
  files:
25
25
  - LICENSE
26
- - README
26
+ - README.markdown
27
27
  - logjam_logger.gemspec
28
28
  - lib/logjam_logger.rb
29
29
  - lib/logjam_logger/buffer.rb
data/README DELETED
@@ -1,12 +0,0 @@
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'
4
-
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:
6
-
7
- before_filter { |controller| $user_id = controller.session[:user_id] || 0 }
8
-
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.
10
-
11
- config.gem 'logjam_logger'
12
- LOGJAM_FORMATTER_CLASS = MyCustomFormatter