sawmill 0.1.14 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +4 -0
- data/Version +1 -1
- data/lib/sawmill/log_record_middleware.rb +1 -1
- data/lib/sawmill/stats_middleware.rb +9 -9
- data/lib/sawmill/stats_railtie.rb +5 -5
- metadata +3 -3
data/History.rdoc
CHANGED
data/Version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.15
|
@@ -51,7 +51,7 @@ module Sawmill
|
|
51
51
|
# Recognized options include:
|
52
52
|
#
|
53
53
|
# [<tt>:request_id_key</tt>]
|
54
|
-
# The name of a rack environment key where the
|
54
|
+
# The name of a rack environment key where the request ID should be
|
55
55
|
# stored. If not specified, defaults to "sawmill.request_id".
|
56
56
|
# [<tt>:start_time_attribute</tt>]
|
57
57
|
# If present, logs an attribute with this name with the starting
|
@@ -55,9 +55,9 @@ module Sawmill
|
|
55
55
|
# [<tt>:stats_data_key</tt>]
|
56
56
|
# The name of a rack environment key where the stats data should
|
57
57
|
# be stored. If not specified, defaults to "sawmill.stats_data".
|
58
|
-
# [<tt>:
|
59
|
-
# The name of a rack environment key where the
|
60
|
-
# obtained. If not specified, defaults to "sawmill.
|
58
|
+
# [<tt>:request_id_key</tt>]
|
59
|
+
# The name of a rack environment key where the request ID can be
|
60
|
+
# obtained. If not specified, defaults to "sawmill.request_id".
|
61
61
|
# [<tt>:start_time_stat</tt>]
|
62
62
|
# If present, stores the starting timestamp for the request in the
|
63
63
|
# given stat key. If absent, does not store this information.
|
@@ -67,8 +67,8 @@ module Sawmill
|
|
67
67
|
# [<tt>:elapsed_time_stat</tt>]
|
68
68
|
# If present, stores the elapsed time for the request in the
|
69
69
|
# given stat key. If absent, does not store this information.
|
70
|
-
# [<tt>:
|
71
|
-
# If present, stores the
|
70
|
+
# [<tt>:request_id_stat</tt>]
|
71
|
+
# If present, stores the request ID for the request in the
|
72
72
|
# given stat key. If absent, does not store this information.
|
73
73
|
# [<tt>:pre_logger</tt>]
|
74
74
|
# A proc that is called at the start of the request, and passed the
|
@@ -87,11 +87,11 @@ module Sawmill
|
|
87
87
|
@logger = logger_ || Logger.new(:progname => 'stats', :processor => Formatter.new(::STDOUT))
|
88
88
|
@level = level_ || :ANY
|
89
89
|
@stats_data_key = opts_[:stats_data_key] || 'sawmill.stats_data'
|
90
|
-
@
|
90
|
+
@request_id_key = opts_[:request_id_key] || 'sawmill.request_id'
|
91
91
|
@start_time_stat = opts_[:start_time_stat]
|
92
92
|
@end_time_stat = opts_[:end_time_stat]
|
93
93
|
@elapsed_time_stat = opts_[:elapsed_time_stat]
|
94
|
-
@
|
94
|
+
@request_id_stat = opts_[:request_id_stat]
|
95
95
|
@pre_logger = opts_[:pre_logger]
|
96
96
|
@post_logger = opts_[:post_logger]
|
97
97
|
end
|
@@ -111,8 +111,8 @@ module Sawmill
|
|
111
111
|
return @app.call(env_)
|
112
112
|
ensure
|
113
113
|
if enable_log_
|
114
|
-
if @
|
115
|
-
stats_data_[@
|
114
|
+
if @request_id_stat
|
115
|
+
stats_data_[@request_id_stat.to_s] = env_[@request_id_key]
|
116
116
|
end
|
117
117
|
if @post_logger
|
118
118
|
enable_log_ &&= @post_logger.call(stats_data_, env_)
|
@@ -70,11 +70,11 @@ module Sawmill
|
|
70
70
|
@length_limit = nil
|
71
71
|
@level = :ANY
|
72
72
|
@progname = 'rails'
|
73
|
-
@stats_data_key = 'sawmill.
|
73
|
+
@stats_data_key = 'sawmill.stats_data'
|
74
74
|
@start_time_stat = nil
|
75
75
|
@end_time_stat = nil
|
76
76
|
@elapsed_time_stat = nil
|
77
|
-
@
|
77
|
+
@request_id_stat = nil
|
78
78
|
@pre_logger = nil
|
79
79
|
@post_logger = nil
|
80
80
|
@generated_logger = nil
|
@@ -109,7 +109,7 @@ module Sawmill
|
|
109
109
|
# This option is passed to Sawmill::StatsMiddleware::new
|
110
110
|
attr_accessor :elapsed_time_stat
|
111
111
|
# This option is passed to Sawmill::StatsMiddleware::new
|
112
|
-
attr_accessor :
|
112
|
+
attr_accessor :request_id_stat
|
113
113
|
|
114
114
|
# Access the logger after it is generated
|
115
115
|
attr_reader :generated_logger
|
@@ -162,8 +162,8 @@ module Sawmill
|
|
162
162
|
stats_config_._set_generated_logger(logger_)
|
163
163
|
app_.config.middleware.insert_after(::Rack::Runtime,
|
164
164
|
::Sawmill::StatsMiddleware, logger_, stats_config_.level,
|
165
|
-
:
|
166
|
-
stats_config_.
|
165
|
+
:request_id_stat => sawmill_config_ && stats_config_.request_id_stat ?
|
166
|
+
stats_config_.request_id_stat : nil,
|
167
167
|
:stats_data_key => stats_config_.stats_data_key,
|
168
168
|
:start_time_stat => stats_config_.start_time_stat,
|
169
169
|
:end_time_stat => stats_config_.end_time_stat,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sawmill
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-10-25 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: blockenspiel
|
16
|
-
requirement: &
|
16
|
+
requirement: &2164525840 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 0.4.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2164525840
|
25
25
|
description: Sawmill is a logging and log analysis system for Ruby. It extends the
|
26
26
|
basic Ruby logging facility with log records and parsing abilities.
|
27
27
|
email: dazuma@gmail.com
|