rack-key_value_logger 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.md CHANGED
@@ -1,4 +1,11 @@
1
+ ## 0.4.1
2
+ * Add tagged logging support (@anveo)
3
+
4
+ ## 0.4.0
5
+
6
+ * BREAKING: Changed the timestamp format from a non-structured weird prepended message to a normal `ts` field.
7
+
1
8
  ## 0.3.1
2
9
 
3
10
  * (feature) Add `:ignore_paths` option
4
- * Add human-readable timestamp to each log line
11
+ * Add human-readable timestamp to each log line
data/README.md CHANGED
@@ -15,7 +15,7 @@ separated by a "=" character. Pairs are separated by pipe ("|") characters.
15
15
  Here's an example of what a log line looks like:
16
16
 
17
17
  ```
18
- [1351714706 2012-10-31 20:18:26 UTC] method=GET|url=/homepage|params=page=2|user_id=123|scheme=http|user_agent=curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5|remote_ip=127.0.0.1|http_version=HTTP/1.1|requested_content_type=text/html|log_source=key_value_logger|status=200|content-length=111|content_type=text/html|runtime=21.553
18
+ ts=2013-04-26T01:14:36Z|method=GET|url=/homepage|params=page=2|user_id=123|scheme=http|user_agent=curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5|remote_ip=127.0.0.1|http_version=HTTP/1.1|requested_content_type=text/html|log_source=key_value_logger|status=200|content-length=111|content_type=text/html|runtime=21.553
19
19
  ```
20
20
 
21
21
  ## Get Started
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class KeyValueLogger
3
- VERSION = '0.4.0'
3
+ VERSION = '0.4.1'
4
4
  end
5
5
  end
@@ -62,6 +62,7 @@ module Rack
62
62
  mobile_device = env['X_MOBILE_DEVICE']
63
63
  url = request.path
64
64
  query_string = env['QUERY_STRING']
65
+ request_id = env['action_dispatch.request_id'] || env['HTTP_X_REQUEST_ID']
65
66
 
66
67
  if ignored_path?(url)
67
68
  return @app.call(env)
@@ -69,6 +70,7 @@ module Rack
69
70
 
70
71
  # record request attributes
71
72
  msg << "ts=#{Time.now.utc.iso8601}"
73
+ msg << "request_id=#{request_id}" if request_id
72
74
  msg << "method=#{request.request_method}"
73
75
  msg << "url=#{url}"
74
76
  msg << "params=#{query_string}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-key_value_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-26 00:00:00.000000000 Z
12
+ date: 2013-05-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json