grape_logging 1.8.4 → 3.0.0
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.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +36 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +14 -0
- data/.rubocop_todo.yml +160 -0
- data/CHANGELOG.md +215 -0
- data/CONTRIBUTING.md +110 -0
- data/README.md +14 -13
- data/RELEASING.md +113 -0
- data/Rakefile +41 -0
- data/bin/console +0 -0
- data/grape_logging.gemspec +14 -11
- data/lib/grape_logging/formatters/default.rb +1 -0
- data/lib/grape_logging/formatters/logstash.rb +3 -3
- data/lib/grape_logging/formatters/rails.rb +3 -5
- data/lib/grape_logging/loggers/base.rb +1 -1
- data/lib/grape_logging/loggers/client_env.rb +1 -1
- data/lib/grape_logging/loggers/filter_parameters.rb +20 -2
- data/lib/grape_logging/loggers/request_headers.rb +0 -2
- data/lib/grape_logging/loggers/response.rb +3 -4
- data/lib/grape_logging/middleware/request_logger.rb +26 -25
- data/lib/grape_logging/multi_io.rb +2 -2
- data/lib/grape_logging/reporters/active_support_reporter.rb +1 -1
- data/lib/grape_logging/reporters/logger_reporter.rb +2 -4
- data/lib/grape_logging/timings.rb +5 -7
- data/lib/grape_logging/util/parameter_filter.rb +9 -7
- data/lib/grape_logging/version.rb +1 -1
- metadata +20 -30
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 06aaf18280f4233ee64c9ec952860f1db9e6119ea832efc5a29d93601b73f0ce
|
|
4
|
+
data.tar.gz: bab90314228b6b136cb6b726328bcf06753ca808c6dd49d42b548356672f5e8f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 81ad7895d92bfdbc1a581d2d618875419c5dc5eed78172d6b4785cf4ec62b466e634eab831a28f39b799c126d430643a5bf438d14ba31bba4e93bba368790e57
|
|
7
|
+
data.tar.gz: d917cfb3390d1b205133ee84d16b86b5b9904e3a8a16fdc05d987057a7fefb06df005a6e5b65b708c15546b973bfa8ebf64472ac9d471cc1c42b4f3dfea0d445
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [master]
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
test:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
strategy:
|
|
11
|
+
matrix:
|
|
12
|
+
ruby-version: ["3.0", "3.1", "3.2", "3.3", "3.4"]
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
- uses: ruby/setup-ruby@v1
|
|
17
|
+
with:
|
|
18
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
19
|
+
bundler-cache: true
|
|
20
|
+
- name: Install dependencies
|
|
21
|
+
run: bundle install
|
|
22
|
+
- name: Run tests
|
|
23
|
+
run: bundle exec rake spec
|
|
24
|
+
lint:
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- name: Checkout code
|
|
28
|
+
uses: actions/checkout@v4
|
|
29
|
+
- uses: ruby/setup-ruby@v1
|
|
30
|
+
with:
|
|
31
|
+
ruby-version: "3.4"
|
|
32
|
+
bundler-cache: true
|
|
33
|
+
- name: Install dependencies
|
|
34
|
+
run: bundle install
|
|
35
|
+
- name: Run RuboCop
|
|
36
|
+
run: bundle exec rake rubocop
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
|
2
|
+
|
|
3
|
+
AllCops:
|
|
4
|
+
NewCops: enable
|
|
5
|
+
|
|
6
|
+
Metrics/BlockLength:
|
|
7
|
+
CountAsOne: [array, hash, heredoc, method_call]
|
|
8
|
+
|
|
9
|
+
Metrics/ClassLength:
|
|
10
|
+
CountAsOne: [array, hash, heredoc, method_call]
|
|
11
|
+
|
|
12
|
+
Metrics/MethodLength:
|
|
13
|
+
CountAsOne: [array, hash, heredoc, method_call]
|
|
14
|
+
Max: 20
|
data/.rubocop_todo.yml
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# This configuration was generated by
|
|
2
|
+
# `rubocop --auto-gen-config`
|
|
3
|
+
# on 2025-07-10 10:25:51 UTC using RuboCop version 1.77.0.
|
|
4
|
+
# The point is for the user to remove these configuration records
|
|
5
|
+
# one by one as the offenses are removed from the code base.
|
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
+
|
|
9
|
+
# Offense count: 3
|
|
10
|
+
# Configuration parameters: EnforcedStyle, AllowedGems, Include.
|
|
11
|
+
# SupportedStyles: Gemfile, gems.rb, gemspec
|
|
12
|
+
# Include: **/*.gemspec, **/Gemfile, **/gems.rb
|
|
13
|
+
Gemspec/DevelopmentDependencies:
|
|
14
|
+
Exclude:
|
|
15
|
+
- "grape_logging.gemspec"
|
|
16
|
+
|
|
17
|
+
# Offense count: 1
|
|
18
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
19
|
+
# Configuration parameters: Severity, Include.
|
|
20
|
+
# Include: **/*.gemspec
|
|
21
|
+
Gemspec/RequireMFA:
|
|
22
|
+
Exclude:
|
|
23
|
+
- "grape_logging.gemspec"
|
|
24
|
+
|
|
25
|
+
# Offense count: 1
|
|
26
|
+
# Configuration parameters: Severity, Include.
|
|
27
|
+
# Include: **/*.gemspec
|
|
28
|
+
Gemspec/RequiredRubyVersion:
|
|
29
|
+
Exclude:
|
|
30
|
+
- "grape_logging.gemspec"
|
|
31
|
+
|
|
32
|
+
# Offense count: 1
|
|
33
|
+
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
|
|
34
|
+
Lint/DuplicateBranch:
|
|
35
|
+
Exclude:
|
|
36
|
+
- "lib/grape_logging/util/parameter_filter.rb"
|
|
37
|
+
|
|
38
|
+
# Offense count: 1
|
|
39
|
+
# Configuration parameters: AllowedParentClasses.
|
|
40
|
+
Lint/MissingSuper:
|
|
41
|
+
Exclude:
|
|
42
|
+
- "lib/grape_logging/loggers/filter_parameters.rb"
|
|
43
|
+
|
|
44
|
+
# Offense count: 3
|
|
45
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
|
46
|
+
Metrics/AbcSize:
|
|
47
|
+
Max: 38
|
|
48
|
+
|
|
49
|
+
# Offense count: 8
|
|
50
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
51
|
+
# AllowedMethods: refine
|
|
52
|
+
Metrics/BlockLength:
|
|
53
|
+
Max: 90
|
|
54
|
+
|
|
55
|
+
# Offense count: 3
|
|
56
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
57
|
+
Metrics/CyclomaticComplexity:
|
|
58
|
+
Max: 18
|
|
59
|
+
|
|
60
|
+
# Offense count: 2
|
|
61
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
62
|
+
Metrics/PerceivedComplexity:
|
|
63
|
+
Max: 19
|
|
64
|
+
|
|
65
|
+
# Offense count: 2
|
|
66
|
+
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
|
|
67
|
+
# SupportedStyles: snake_case, normalcase, non_integer
|
|
68
|
+
# AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
|
|
69
|
+
Naming/VariableNumber:
|
|
70
|
+
Exclude:
|
|
71
|
+
- "spec/lib/grape_logging/formatters/rails_spec.rb"
|
|
72
|
+
|
|
73
|
+
# Offense count: 3
|
|
74
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
75
|
+
# Configuration parameters: MinBranchesCount.
|
|
76
|
+
Style/CaseLikeIf:
|
|
77
|
+
Exclude:
|
|
78
|
+
- "lib/grape_logging/formatters/default.rb"
|
|
79
|
+
- "lib/grape_logging/formatters/logstash.rb"
|
|
80
|
+
- "lib/grape_logging/formatters/rails.rb"
|
|
81
|
+
|
|
82
|
+
# Offense count: 17
|
|
83
|
+
# Configuration parameters: AllowedConstants.
|
|
84
|
+
Style/Documentation:
|
|
85
|
+
Enabled: false
|
|
86
|
+
|
|
87
|
+
# Offense count: 29
|
|
88
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
89
|
+
# Configuration parameters: EnforcedStyle.
|
|
90
|
+
# SupportedStyles: always, always_true, never
|
|
91
|
+
Style/FrozenStringLiteralComment:
|
|
92
|
+
Enabled: false
|
|
93
|
+
|
|
94
|
+
# Offense count: 1
|
|
95
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
96
|
+
Style/GlobalStdStream:
|
|
97
|
+
Exclude:
|
|
98
|
+
- "lib/grape_logging/reporters/logger_reporter.rb"
|
|
99
|
+
|
|
100
|
+
# Offense count: 1
|
|
101
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
102
|
+
# Configuration parameters: EnforcedStyle.
|
|
103
|
+
# SupportedStyles: literals, strict
|
|
104
|
+
Style/MutableConstant:
|
|
105
|
+
Exclude:
|
|
106
|
+
- "lib/grape_logging/version.rb"
|
|
107
|
+
|
|
108
|
+
# Offense count: 10
|
|
109
|
+
Style/OpenStructUse:
|
|
110
|
+
Exclude:
|
|
111
|
+
- "spec/lib/grape_logging/loggers/client_env_spec.rb"
|
|
112
|
+
- "spec/lib/grape_logging/loggers/filter_parameters_spec.rb"
|
|
113
|
+
- "spec/lib/grape_logging/loggers/request_headers_spec.rb"
|
|
114
|
+
- "spec/lib/grape_logging/loggers/response_spec.rb"
|
|
115
|
+
|
|
116
|
+
# Offense count: 3
|
|
117
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
118
|
+
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
|
|
119
|
+
# AllowedMethods: present?, blank?, presence, try, try!
|
|
120
|
+
Style/SafeNavigation:
|
|
121
|
+
Exclude:
|
|
122
|
+
- "lib/grape_logging/formatters/rails.rb"
|
|
123
|
+
|
|
124
|
+
# Offense count: 1
|
|
125
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
126
|
+
Style/SlicingWithRange:
|
|
127
|
+
Exclude:
|
|
128
|
+
- "lib/grape_logging/loggers/request_headers.rb"
|
|
129
|
+
|
|
130
|
+
# Offense count: 1
|
|
131
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
132
|
+
# Configuration parameters: RequireEnglish, EnforcedStyle.
|
|
133
|
+
# SupportedStyles: use_perl_names, use_english_names, use_builtin_english_names
|
|
134
|
+
Style/SpecialGlobalVars:
|
|
135
|
+
Exclude:
|
|
136
|
+
- "spec/spec_helper.rb"
|
|
137
|
+
|
|
138
|
+
# Offense count: 3
|
|
139
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
140
|
+
# Configuration parameters: Mode.
|
|
141
|
+
Style/StringConcatenation:
|
|
142
|
+
Exclude:
|
|
143
|
+
- "lib/grape_logging/formatters/json.rb"
|
|
144
|
+
- "lib/grape_logging/formatters/lograge.rb"
|
|
145
|
+
- "lib/grape_logging/formatters/logstash.rb"
|
|
146
|
+
|
|
147
|
+
# Offense count: 1
|
|
148
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
149
|
+
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
|
|
150
|
+
# AllowedMethods: define_method
|
|
151
|
+
Style/SymbolProc:
|
|
152
|
+
Exclude:
|
|
153
|
+
- "lib/grape_logging/util/parameter_filter.rb"
|
|
154
|
+
|
|
155
|
+
# Offense count: 11
|
|
156
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
157
|
+
# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
|
|
158
|
+
# URISchemes: http, https
|
|
159
|
+
Layout/LineLength:
|
|
160
|
+
Max: 203
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [3.0.0] - 2025-08-07
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- [#93](https://github.com/aserafin/grape_logging/pull/93) RequestLogger middleware to handle Grape 2.4 breaking change - [@devsigner](https://github.com/devsigner) and [@samsonjs](https://github.com/samsonjs).
|
|
7
|
+
|
|
8
|
+
[3.0.0]: https://github.com/aserafin/grape_logging/compare/v2.1.1...v3.0.0
|
|
9
|
+
|
|
10
|
+
## [2.1.1] - 2025-07-09
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- [#92](https://github.com/aserafin/grape_logging/pull/92) Handle symbol param keys during filtering - [@samsonjs](https://github.com/samsonjs).
|
|
14
|
+
|
|
15
|
+
[2.1.1]: https://github.com/aserafin/grape_logging/compare/v2.1.0...v2.1.1
|
|
16
|
+
|
|
17
|
+
## [2.1.0] - 2025-07-09
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
- [#91](https://github.com/aserafin/grape_logging/pull/91) Add ActionDispatch request ID to logger arguments hash as `:request_id` - [@samsonjs](https://github.com/samsonjs).
|
|
21
|
+
|
|
22
|
+
[2.1.0]: https://github.com/aserafin/grape_logging/compare/v2.0.0...v2.1.0
|
|
23
|
+
|
|
24
|
+
## [2.0.0] - 2025-07-09
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
- **BREAKING**: Updated to support Grape 2.1 and Rack 3.1
|
|
28
|
+
- Minimum supported Ruby version is now 3.0
|
|
29
|
+
- Replaced Travis CI with GitHub Actions for continuous integration
|
|
30
|
+
- Updated all README examples to use `insert_before` instead of `use` for proper middleware placement
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
- Fixed LoggerReporter to clone the logger parameter to prevent shared state issues (#77)
|
|
34
|
+
- Fixed view time precision issue by rounding to 2 decimal places
|
|
35
|
+
- Fixed invalid byte sequence handling for parameter keys by properly managing string encodings (#54)
|
|
36
|
+
- Fixed various typos in code comments and spec descriptions (#87)
|
|
37
|
+
- Fixed specs to work with Ruby 3.4's hash inspect format changes
|
|
38
|
+
|
|
39
|
+
### Documentation
|
|
40
|
+
- Clarified middleware placement requirements in README - must be inserted before Grape::Middleware::Error (#74)
|
|
41
|
+
- Added gem version badge to README
|
|
42
|
+
|
|
43
|
+
[2.0.0]: https://github.com/aserafin/grape_logging/compare/v1.8.4...v2.0.0
|
|
44
|
+
|
|
45
|
+
## [1.8.4] - 2021-10-29
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
- Rails 6 compatibility improvements
|
|
49
|
+
- Various bug fixes and dependency updates
|
|
50
|
+
|
|
51
|
+
[1.8.4]: https://github.com/aserafin/grape_logging/compare/v1.8.3...v1.8.4
|
|
52
|
+
|
|
53
|
+
## [1.8.3] - 2020-02-27
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
- Performance improvements
|
|
57
|
+
- Bug fixes for edge cases
|
|
58
|
+
|
|
59
|
+
[1.8.3]: https://github.com/aserafin/grape_logging/compare/v1.8.2...v1.8.3
|
|
60
|
+
|
|
61
|
+
## [1.8.2] - 2019-10-08
|
|
62
|
+
|
|
63
|
+
### Fixed
|
|
64
|
+
- Thread safety improvements
|
|
65
|
+
- Minor bug fixes
|
|
66
|
+
|
|
67
|
+
Note: This version was tagged as "v.1.8.2" (with extra dot)
|
|
68
|
+
|
|
69
|
+
[1.8.2]: https://github.com/aserafin/grape_logging/compare/v1.8.1...v.1.8.2
|
|
70
|
+
|
|
71
|
+
## [1.8.1] - 2019-08-07
|
|
72
|
+
|
|
73
|
+
### Fixed
|
|
74
|
+
- Bug fixes for parameter filtering
|
|
75
|
+
- Improved error handling
|
|
76
|
+
|
|
77
|
+
[1.8.1]: https://github.com/aserafin/grape_logging/compare/v1.8.0...v1.8.1
|
|
78
|
+
|
|
79
|
+
## [1.8.0] - 2019-05-30
|
|
80
|
+
|
|
81
|
+
### Added
|
|
82
|
+
- Rails formatter for better Rails integration
|
|
83
|
+
- Improved Rails instrumentation support
|
|
84
|
+
|
|
85
|
+
[1.8.0]: https://github.com/aserafin/grape_logging/compare/v1.7.0...v1.8.0
|
|
86
|
+
|
|
87
|
+
## [1.7.0] - 2017-11-09
|
|
88
|
+
|
|
89
|
+
### Added
|
|
90
|
+
- Logstash formatter for ELK stack integration
|
|
91
|
+
- Enhanced JSON formatting options
|
|
92
|
+
|
|
93
|
+
[1.7.0]: https://github.com/aserafin/grape_logging/compare/v1.6.0...v1.7.0
|
|
94
|
+
|
|
95
|
+
## [1.6.0] - 2017-07-20
|
|
96
|
+
|
|
97
|
+
### Added
|
|
98
|
+
- MultiIO support for logging to multiple destinations simultaneously
|
|
99
|
+
- Can now log to both file and STDOUT
|
|
100
|
+
|
|
101
|
+
[1.6.0]: https://github.com/aserafin/grape_logging/compare/v1.5.0...v1.6.0
|
|
102
|
+
|
|
103
|
+
## [1.5.0] - 2017-06-15
|
|
104
|
+
|
|
105
|
+
### Added
|
|
106
|
+
- Configurable log levels
|
|
107
|
+
- Better control over logging verbosity
|
|
108
|
+
|
|
109
|
+
[1.5.0]: https://github.com/aserafin/grape_logging/compare/v1.4.0...v1.5.0
|
|
110
|
+
|
|
111
|
+
## [1.4.0] - 2017-01-12
|
|
112
|
+
|
|
113
|
+
### Added
|
|
114
|
+
- FilterParameters logger for sensitive parameter filtering
|
|
115
|
+
- Automatic Rails filter_parameters integration when available
|
|
116
|
+
|
|
117
|
+
[1.4.0]: https://github.com/aserafin/grape_logging/compare/v1.3.0...v1.4.0
|
|
118
|
+
|
|
119
|
+
## [1.3.0] - 2016-12-08
|
|
120
|
+
|
|
121
|
+
### Added
|
|
122
|
+
- RequestHeaders logger for logging HTTP request headers
|
|
123
|
+
- ClientEnv logger for logging client IP and user agent
|
|
124
|
+
|
|
125
|
+
[1.3.0]: https://github.com/aserafin/grape_logging/compare/v1.2.1...v1.3.0
|
|
126
|
+
|
|
127
|
+
## [1.2.1] - 2016-04-14
|
|
128
|
+
|
|
129
|
+
### Added
|
|
130
|
+
- JSON formatter for structured logging
|
|
131
|
+
- Rails instrumentation support via ActiveSupport::Notifications
|
|
132
|
+
|
|
133
|
+
### Fixed
|
|
134
|
+
- Parameter handling improvements
|
|
135
|
+
|
|
136
|
+
[1.2.1]: https://github.com/aserafin/grape_logging/compare/v1.2.0...v1.2.1
|
|
137
|
+
|
|
138
|
+
## [1.2.0] - 2016-01-21
|
|
139
|
+
|
|
140
|
+
### Added
|
|
141
|
+
- Response logger for logging response details
|
|
142
|
+
- Improved parameter logging
|
|
143
|
+
|
|
144
|
+
### Changed
|
|
145
|
+
- Better integration with Grape middleware stack
|
|
146
|
+
|
|
147
|
+
[1.2.0]: https://github.com/aserafin/grape_logging/compare/v1.1.3...v1.2.0
|
|
148
|
+
|
|
149
|
+
## [1.1.3] - 2015-12-03
|
|
150
|
+
|
|
151
|
+
### Fixed
|
|
152
|
+
- Bug fixes for Grape 0.14 compatibility
|
|
153
|
+
- Improved error handling
|
|
154
|
+
|
|
155
|
+
[1.1.3]: https://github.com/aserafin/grape_logging/compare/v1.1.2...v1.1.3
|
|
156
|
+
|
|
157
|
+
## [1.1.2] - 2015-11-19
|
|
158
|
+
|
|
159
|
+
### Fixed
|
|
160
|
+
- Performance optimizations
|
|
161
|
+
- Minor bug fixes
|
|
162
|
+
|
|
163
|
+
[1.1.2]: https://github.com/aserafin/grape_logging/compare/v1.1.1...v1.1.2
|
|
164
|
+
|
|
165
|
+
## [1.1.1] - 2015-11-12
|
|
166
|
+
|
|
167
|
+
### Fixed
|
|
168
|
+
- Critical bug fix for middleware initialization
|
|
169
|
+
|
|
170
|
+
Note: This version was tagged as "v.1.1.1" (with extra dot)
|
|
171
|
+
|
|
172
|
+
[1.1.1]: https://github.com/aserafin/grape_logging/compare/v1.1.0...v.1.1.1
|
|
173
|
+
|
|
174
|
+
## [1.1.0] - 2015-11-09
|
|
175
|
+
|
|
176
|
+
### Added
|
|
177
|
+
- Pluggable logger architecture
|
|
178
|
+
- Support for custom loggers via include option
|
|
179
|
+
- Base logger class for extending functionality
|
|
180
|
+
|
|
181
|
+
### Changed
|
|
182
|
+
- Refactored middleware for better extensibility
|
|
183
|
+
|
|
184
|
+
[1.1.0]: https://github.com/aserafin/grape_logging/compare/v1.0.3...v1.1.0
|
|
185
|
+
|
|
186
|
+
## [1.0.3] - 2015-11-05
|
|
187
|
+
|
|
188
|
+
### Fixed
|
|
189
|
+
- Compatibility fixes for different Grape versions
|
|
190
|
+
- Bug fixes
|
|
191
|
+
|
|
192
|
+
[1.0.3]: https://github.com/aserafin/grape_logging/compare/v1.0.2...v1.0.3
|
|
193
|
+
|
|
194
|
+
## [1.0.2] - 2015-10-29
|
|
195
|
+
|
|
196
|
+
### Fixed
|
|
197
|
+
- Minor bug fixes and improvements
|
|
198
|
+
|
|
199
|
+
[1.0.2]: https://github.com/aserafin/grape_logging/compare/v1.0.1...v1.0.2
|
|
200
|
+
|
|
201
|
+
## [1.0.1] - 2015-10-22
|
|
202
|
+
|
|
203
|
+
### Fixed
|
|
204
|
+
- Initial bug fixes after 1.0 release
|
|
205
|
+
|
|
206
|
+
[1.0.1]: https://github.com/aserafin/grape_logging/compare/v1.0...v1.0.1
|
|
207
|
+
|
|
208
|
+
## [1.0] - 2015-10-15
|
|
209
|
+
|
|
210
|
+
### Added
|
|
211
|
+
- Initial release
|
|
212
|
+
- Request logging middleware for Grape APIs
|
|
213
|
+
- Basic request/response logging
|
|
214
|
+
- Configurable formatters
|
|
215
|
+
- Time tracking (total, db, view)
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Contributing to grape_logging
|
|
2
|
+
|
|
3
|
+
This project is work of many contributors. You're encouraged to submit pull requests, propose features and discuss issues.
|
|
4
|
+
|
|
5
|
+
## Fork the Project
|
|
6
|
+
|
|
7
|
+
Fork the project on Github and check out your copy.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
git clone https://github.com/contributor/grape_logging.git
|
|
11
|
+
cd grape_logging
|
|
12
|
+
git remote add upstream https://github.com/aserafin/grape_logging.git
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Create a Topic Branch
|
|
16
|
+
|
|
17
|
+
Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
git checkout master
|
|
21
|
+
git pull upstream master
|
|
22
|
+
git checkout -b my-feature-branch
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Bundle Install and Test
|
|
26
|
+
|
|
27
|
+
Ensure that you can build the project and run tests.
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
bundle install
|
|
31
|
+
bundle exec rake
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Write Tests
|
|
35
|
+
|
|
36
|
+
Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build. Add to the spec directory.
|
|
37
|
+
|
|
38
|
+
## Write Code
|
|
39
|
+
|
|
40
|
+
Implement your feature or bug fix.
|
|
41
|
+
|
|
42
|
+
Ruby style is enforced with RuboCop. Run `bundle exec rubocop` and fix any style issues highlighted.
|
|
43
|
+
|
|
44
|
+
Make sure that `bundle exec rake` completes without errors.
|
|
45
|
+
|
|
46
|
+
## Write Documentation
|
|
47
|
+
|
|
48
|
+
Document any external behavior in the README.md.
|
|
49
|
+
|
|
50
|
+
## Update Changelog
|
|
51
|
+
|
|
52
|
+
Add a line to Changelog.md under *Next Release*. Make it look like every other line, including your name and link to your Github account.
|
|
53
|
+
|
|
54
|
+
## Commit Changes
|
|
55
|
+
|
|
56
|
+
Make sure git knows your name and email address:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
git config --global user.name "Your Name"
|
|
60
|
+
git config --global user.email "contributor@example.com"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Writing good commit logs is important. A commit log should describe what changed and why.
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
git add ...
|
|
67
|
+
git commit
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Push
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
git push origin my-feature-branch
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Make a Pull Request
|
|
77
|
+
|
|
78
|
+
Go to https://github.com/contributor/grape_logging and select your feature branch. Click the 'Pull Request' button and fill out the form.
|
|
79
|
+
|
|
80
|
+
We'll try to review pull requests within a few days but as this is maintained by a small group of volunteers there is no guarantee that we'll look at it within any time frame, or at all. There's no maintenance guarantee.
|
|
81
|
+
|
|
82
|
+
## Discuss and Update
|
|
83
|
+
|
|
84
|
+
You may get feedback or requests for changes to your pull request. This is a big part of the submission process so don't be discouraged!
|
|
85
|
+
|
|
86
|
+
Some things that will increase the chance that your pull request is accepted:
|
|
87
|
+
|
|
88
|
+
- Write tests.
|
|
89
|
+
- Follow the Ruby style guide.
|
|
90
|
+
- Write a good commit message.
|
|
91
|
+
|
|
92
|
+
If you'd like to discuss a feature or bug fix before starting work, please [create an issue](https://github.com/aserafin/grape_logging/issues) first. This helps ensure your contribution aligns with the project's direction and avoids duplicate efforts.
|
|
93
|
+
|
|
94
|
+
## Rebase
|
|
95
|
+
|
|
96
|
+
If you've been working on a change for a while, rebase with upstream/master.
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
git fetch upstream
|
|
100
|
+
git rebase upstream/master
|
|
101
|
+
git push origin my-feature-branch -f
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Be Patient
|
|
105
|
+
|
|
106
|
+
It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang in there!
|
|
107
|
+
|
|
108
|
+
## Thank You
|
|
109
|
+
|
|
110
|
+
Please do know that we really appreciate and value your time and work. We love you, really.
|
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# grape_logging
|
|
2
2
|
|
|
3
|
-
[](https://badge.fury.io/rb/grape_logging)
|
|
4
|
+
[](https://github.com/aserafin/grape_logging/actions/workflows/ci.yml)
|
|
5
5
|
|
|
6
6
|
## Installation
|
|
7
7
|
|
|
@@ -19,12 +19,12 @@ Or install it yourself as:
|
|
|
19
19
|
|
|
20
20
|
## Basic Usage
|
|
21
21
|
|
|
22
|
-
In your
|
|
22
|
+
In your API file (somewhere on the top), insert grape logging middleware before grape error middleware. This is important due to the behaviour of `lib/grape/middleware/error.rb`, which manipulates the status of the response when there is an error.
|
|
23
23
|
|
|
24
24
|
```ruby
|
|
25
25
|
require 'grape_logging'
|
|
26
26
|
logger.formatter = GrapeLogging::Formatters::Default.new
|
|
27
|
-
|
|
27
|
+
insert_before Grape::Middleware::Error, GrapeLogging::Middleware::RequestLogger, { logger: logger }
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
**ProTip:** If your logger doesn't support setting formatter you can remove this line - it's optional
|
|
@@ -114,7 +114,7 @@ end
|
|
|
114
114
|
You can change the formatter like so
|
|
115
115
|
```ruby
|
|
116
116
|
class MyAPI < Grape::API
|
|
117
|
-
|
|
117
|
+
insert_before Grape::Middleware::Error, GrapeLogging::Middleware::RequestLogger, logger: logger, formatter: MyFormatter.new
|
|
118
118
|
end
|
|
119
119
|
```
|
|
120
120
|
|
|
@@ -125,7 +125,8 @@ If you prefer some other format I strongly encourage you to do pull request with
|
|
|
125
125
|
You can include logging of other parts of the request / response cycle by including subclasses of `GrapeLogging::Loggers::Base`
|
|
126
126
|
```ruby
|
|
127
127
|
class MyAPI < Grape::API
|
|
128
|
-
|
|
128
|
+
insert_before Grape::Middleware::Error,
|
|
129
|
+
GrapeLogging::Middleware::RequestLogger,
|
|
129
130
|
logger: logger,
|
|
130
131
|
include: [ GrapeLogging::Loggers::Response.new,
|
|
131
132
|
GrapeLogging::Loggers::FilterParameters.new,
|
|
@@ -158,7 +159,8 @@ You can control the level used to log. The default is `info`.
|
|
|
158
159
|
|
|
159
160
|
```ruby
|
|
160
161
|
class MyAPI < Grape::API
|
|
161
|
-
|
|
162
|
+
insert_before Grape::Middleware::Error,
|
|
163
|
+
GrapeLogging::Middleware::RequestLogger,
|
|
162
164
|
logger: logger,
|
|
163
165
|
log_level: 'debug'
|
|
164
166
|
end
|
|
@@ -170,7 +172,8 @@ You can choose to not pass the logger to ```grape_logging``` but instead send lo
|
|
|
170
172
|
First, config ```grape_logging```, like that:
|
|
171
173
|
```ruby
|
|
172
174
|
class MyAPI < Grape::API
|
|
173
|
-
|
|
175
|
+
insert_before Grape::Middleware::Error,
|
|
176
|
+
GrapeLogging::Middleware::RequestLogger,
|
|
174
177
|
instrumentation_key: 'grape_key',
|
|
175
178
|
include: [ GrapeLogging::Loggers::Response.new,
|
|
176
179
|
GrapeLogging::Loggers::FilterParameters.new ]
|
|
@@ -206,10 +209,8 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
|
206
209
|
|
|
207
210
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
208
211
|
|
|
212
|
+
For maintainers releasing a new version, please see [Releasing.md](Releasing.md).
|
|
213
|
+
|
|
209
214
|
## Contributing
|
|
210
215
|
|
|
211
|
-
|
|
212
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
213
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
214
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
|
215
|
-
5. Create a new Pull Request
|
|
216
|
+
See [Contributing.md](Contributing.md).
|