rack-action_logger 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +53 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +51 -0
- data/LICENSE.txt +21 -0
- data/README.md +108 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/rspec +17 -0
- data/bin/setup +8 -0
- data/docs/action_log.png +0 -0
- data/docs/attributed_log.png +0 -0
- data/docs/request_log.png +0 -0
- data/docs/sample_log.png +0 -0
- data/example/rails4/.generators +8 -0
- data/example/rails4/.gitignore +48 -0
- data/example/rails4/.rakeTasks +7 -0
- data/example/rails4/Gemfile +53 -0
- data/example/rails4/Gemfile.lock +192 -0
- data/example/rails4/README.rdoc +28 -0
- data/example/rails4/Rakefile +6 -0
- data/example/rails4/app/assets/images/.keep +0 -0
- data/example/rails4/app/assets/javascripts/application.js +16 -0
- data/example/rails4/app/assets/javascripts/hello.coffee +3 -0
- data/example/rails4/app/assets/stylesheets/application.css +15 -0
- data/example/rails4/app/assets/stylesheets/hello.scss +3 -0
- data/example/rails4/app/controllers/application_controller.rb +7 -0
- data/example/rails4/app/controllers/concerns/.keep +0 -0
- data/example/rails4/app/controllers/hello_controller.rb +6 -0
- data/example/rails4/app/helpers/application_helper.rb +2 -0
- data/example/rails4/app/helpers/hello_helper.rb +2 -0
- data/example/rails4/app/mailers/.keep +0 -0
- data/example/rails4/app/models/.keep +0 -0
- data/example/rails4/app/models/concerns/.keep +0 -0
- data/example/rails4/app/views/hello/index.html.erb +2 -0
- data/example/rails4/app/views/layouts/application.html.erb +14 -0
- data/example/rails4/bin/bundle +3 -0
- data/example/rails4/bin/rails +4 -0
- data/example/rails4/bin/rake +4 -0
- data/example/rails4/bin/rspec +17 -0
- data/example/rails4/bin/setup +29 -0
- data/example/rails4/config/application.rb +37 -0
- data/example/rails4/config/boot.rb +3 -0
- data/example/rails4/config/database.yml +25 -0
- data/example/rails4/config/environment.rb +5 -0
- data/example/rails4/config/environments/development.rb +41 -0
- data/example/rails4/config/environments/production.rb +79 -0
- data/example/rails4/config/environments/test.rb +42 -0
- data/example/rails4/config/initializers/assets.rb +11 -0
- data/example/rails4/config/initializers/backtrace_silencers.rb +7 -0
- data/example/rails4/config/initializers/cookies_serializer.rb +3 -0
- data/example/rails4/config/initializers/filter_parameter_logging.rb +4 -0
- data/example/rails4/config/initializers/fluent_logger.rb +1 -0
- data/example/rails4/config/initializers/inflections.rb +16 -0
- data/example/rails4/config/initializers/mime_types.rb +4 -0
- data/example/rails4/config/initializers/rack-action_logger.rb +6 -0
- data/example/rails4/config/initializers/session_store.rb +3 -0
- data/example/rails4/config/initializers/wrap_parameters.rb +14 -0
- data/example/rails4/config/locales/en.yml +23 -0
- data/example/rails4/config/routes.rb +3 -0
- data/example/rails4/config/secrets.yml +22 -0
- data/example/rails4/config.ru +4 -0
- data/example/rails4/db/schema.rb +16 -0
- data/example/rails4/db/seeds.rb +7 -0
- data/example/rails4/lib/assets/.keep +0 -0
- data/example/rails4/lib/tasks/.keep +0 -0
- data/example/rails4/public/404.html +67 -0
- data/example/rails4/public/422.html +67 -0
- data/example/rails4/public/500.html +66 -0
- data/example/rails4/public/favicon.ico +0 -0
- data/example/rails4/public/robots.txt +5 -0
- data/example/rails4/spec/controllers/hello_controller_spec.rb +10 -0
- data/example/rails4/spec/rails_helper.rb +57 -0
- data/example/rails4/spec/spec_helper.rb +99 -0
- data/example/rails4/vendor/assets/javascripts/.keep +0 -0
- data/example/rails4/vendor/assets/stylesheets/.keep +0 -0
- data/example/rails5/.generators +8 -0
- data/example/rails5/.gitignore +48 -0
- data/example/rails5/.rakeTasks +7 -0
- data/example/rails5/Gemfile +54 -0
- data/example/rails5/Gemfile.lock +205 -0
- data/example/rails5/README.md +24 -0
- data/example/rails5/Rakefile +6 -0
- data/example/rails5/app/assets/config/manifest.js +3 -0
- data/example/rails5/app/assets/images/.keep +0 -0
- data/example/rails5/app/assets/javascripts/application.js +16 -0
- data/example/rails5/app/assets/javascripts/cable.js +13 -0
- data/example/rails5/app/assets/javascripts/channels/.keep +0 -0
- data/example/rails5/app/assets/javascripts/hello.coffee +3 -0
- data/example/rails5/app/assets/stylesheets/application.css +15 -0
- data/example/rails5/app/assets/stylesheets/hello.scss +3 -0
- data/example/rails5/app/channels/application_cable/channel.rb +4 -0
- data/example/rails5/app/channels/application_cable/connection.rb +4 -0
- data/example/rails5/app/controllers/application_controller.rb +5 -0
- data/example/rails5/app/controllers/concerns/.keep +0 -0
- data/example/rails5/app/controllers/hello_controller.rb +6 -0
- data/example/rails5/app/helpers/application_helper.rb +2 -0
- data/example/rails5/app/helpers/hello_helper.rb +2 -0
- data/example/rails5/app/jobs/application_job.rb +2 -0
- data/example/rails5/app/mailers/application_mailer.rb +4 -0
- data/example/rails5/app/models/application_record.rb +3 -0
- data/example/rails5/app/models/concerns/.keep +0 -0
- data/example/rails5/app/views/hello/index.html.erb +2 -0
- data/example/rails5/app/views/layouts/application.html.erb +14 -0
- data/example/rails5/app/views/layouts/mailer.html.erb +13 -0
- data/example/rails5/app/views/layouts/mailer.text.erb +1 -0
- data/example/rails5/bin/bundle +3 -0
- data/example/rails5/bin/rails +4 -0
- data/example/rails5/bin/rake +17 -0
- data/example/rails5/bin/rspec +17 -0
- data/example/rails5/bin/setup +34 -0
- data/example/rails5/bin/update +29 -0
- data/example/rails5/config/application.rb +13 -0
- data/example/rails5/config/boot.rb +3 -0
- data/example/rails5/config/cable.yml +9 -0
- data/example/rails5/config/database.yml +25 -0
- data/example/rails5/config/environment.rb +5 -0
- data/example/rails5/config/environments/development.rb +54 -0
- data/example/rails5/config/environments/production.rb +86 -0
- data/example/rails5/config/environments/test.rb +42 -0
- data/example/rails5/config/initializers/application_controller_renderer.rb +6 -0
- data/example/rails5/config/initializers/assets.rb +11 -0
- data/example/rails5/config/initializers/backtrace_silencers.rb +7 -0
- data/example/rails5/config/initializers/cookies_serializer.rb +5 -0
- data/example/rails5/config/initializers/filter_parameter_logging.rb +4 -0
- data/example/rails5/config/initializers/fluent_logger.rb +1 -0
- data/example/rails5/config/initializers/inflections.rb +16 -0
- data/example/rails5/config/initializers/mime_types.rb +4 -0
- data/example/rails5/config/initializers/new_framework_defaults.rb +24 -0
- data/example/rails5/config/initializers/rack-action_logger.rb +6 -0
- data/example/rails5/config/initializers/session_store.rb +3 -0
- data/example/rails5/config/initializers/wrap_parameters.rb +14 -0
- data/example/rails5/config/locales/en.yml +23 -0
- data/example/rails5/config/puma.rb +47 -0
- data/example/rails5/config/routes.rb +3 -0
- data/example/rails5/config/secrets.yml +22 -0
- data/example/rails5/config/spring.rb +6 -0
- data/example/rails5/config.ru +5 -0
- data/example/rails5/db/schema.rb +15 -0
- data/example/rails5/db/seeds.rb +7 -0
- data/example/rails5/lib/assets/.keep +0 -0
- data/example/rails5/lib/tasks/.keep +0 -0
- data/example/rails5/public/404.html +67 -0
- data/example/rails5/public/422.html +67 -0
- data/example/rails5/public/500.html +66 -0
- data/example/rails5/public/apple-touch-icon-precomposed.png +0 -0
- data/example/rails5/public/apple-touch-icon.png +0 -0
- data/example/rails5/public/favicon.ico +0 -0
- data/example/rails5/public/robots.txt +5 -0
- data/example/rails5/spec/controllers/hello_controller_spec.rb +10 -0
- data/example/rails5/spec/rails_helper.rb +57 -0
- data/example/rails5/spec/spec_helper.rb +99 -0
- data/example/rails5/vendor/assets/javascripts/.keep +0 -0
- data/example/rails5/vendor/assets/stylesheets/.keep +0 -0
- data/lib/rack/action_logger/configuration.rb +25 -0
- data/lib/rack/action_logger/container.rb +95 -0
- data/lib/rack/action_logger/context.rb +15 -0
- data/lib/rack/action_logger/controller_concerns/request_log.rb +18 -0
- data/lib/rack/action_logger/controller_concerns.rb +8 -0
- data/lib/rack/action_logger/emit_adapter/base.rb +18 -0
- data/lib/rack/action_logger/emit_adapter/fluent_adapter.rb +11 -0
- data/lib/rack/action_logger/emit_adapter/logger_adapter.rb +10 -0
- data/lib/rack/action_logger/emit_adapter/null_adapter.rb +7 -0
- data/lib/rack/action_logger/emitter.rb +44 -0
- data/lib/rack/action_logger/version.rb +5 -0
- data/lib/rack/action_logger.rb +30 -0
- data/rack-action_logger.gemspec +30 -0
- metadata +283 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9b955e3918895971c20ef791cd3b6d1743287dd6
|
4
|
+
data.tar.gz: e46be8cb20cf39216fc345e53b3116ca82ee0a70
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 590a803fa7b3a4b0f6a910439dc50ec0a5ab2d9bbaa1d83df23202cac546421a87e76bc4449b157af5ae71d9c8d3f6704c3864a19f8da3477f92355438521e6b
|
7
|
+
data.tar.gz: f1b2f8502a427f9e352dc8a021ff2eebe4032038fa3040b7b0921a24d1f0823847fbc7b3daba6503a8e53ac1be269dac355ef25b38fb007833de254d4e68f818
|
data/.gitignore
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
|
2
|
+
# Created by https://www.gitignore.io/api/ruby
|
3
|
+
|
4
|
+
### Ruby ###
|
5
|
+
*.rbc
|
6
|
+
/.config
|
7
|
+
/coverage/
|
8
|
+
/InstalledFiles
|
9
|
+
/pkg/
|
10
|
+
/spec/reports/
|
11
|
+
/spec/examples.txt
|
12
|
+
/test/tmp/
|
13
|
+
/test/version_tmp/
|
14
|
+
/tmp/
|
15
|
+
|
16
|
+
# Used by dotenv library to load environment variables.
|
17
|
+
# .env
|
18
|
+
|
19
|
+
## Specific to RubyMotion:
|
20
|
+
.dat*
|
21
|
+
.repl_history
|
22
|
+
build/
|
23
|
+
*.bridgesupport
|
24
|
+
build-iPhoneOS/
|
25
|
+
build-iPhoneSimulator/
|
26
|
+
|
27
|
+
## Specific to RubyMotion (use of CocoaPods):
|
28
|
+
#
|
29
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
30
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
31
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
32
|
+
#
|
33
|
+
# vendor/Pods/
|
34
|
+
|
35
|
+
## Documentation cache and generated files:
|
36
|
+
/.yardoc/
|
37
|
+
/_yardoc/
|
38
|
+
/doc/
|
39
|
+
/rdoc/
|
40
|
+
|
41
|
+
## Environment normalization:
|
42
|
+
/.bundle/
|
43
|
+
/vendor/bundle
|
44
|
+
/lib/bundler/man/
|
45
|
+
|
46
|
+
# for a library or gem, you might want to ignore these files since the code is
|
47
|
+
# intended to run in multiple environments; otherwise, check them in:
|
48
|
+
# Gemfile.lock
|
49
|
+
# .ruby-version
|
50
|
+
# .ruby-gemset
|
51
|
+
|
52
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
53
|
+
.rvmrc
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at wapa5pow@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rack-action_logger (0.1.0)
|
5
|
+
activesupport
|
6
|
+
fluent-logger (~> 0.5)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activesupport (5.0.0.1)
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
+
i18n (~> 0.7)
|
14
|
+
minitest (~> 5.1)
|
15
|
+
tzinfo (~> 1.1)
|
16
|
+
concurrent-ruby (1.0.2)
|
17
|
+
diff-lcs (1.2.5)
|
18
|
+
fluent-logger (0.6.1)
|
19
|
+
msgpack (>= 0.5.6, < 2)
|
20
|
+
i18n (0.7.0)
|
21
|
+
minitest (5.9.1)
|
22
|
+
msgpack (1.0.2)
|
23
|
+
rake (10.5.0)
|
24
|
+
rspec (3.5.0)
|
25
|
+
rspec-core (~> 3.5.0)
|
26
|
+
rspec-expectations (~> 3.5.0)
|
27
|
+
rspec-mocks (~> 3.5.0)
|
28
|
+
rspec-core (3.5.4)
|
29
|
+
rspec-support (~> 3.5.0)
|
30
|
+
rspec-expectations (3.5.0)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.5.0)
|
33
|
+
rspec-mocks (3.5.0)
|
34
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
+
rspec-support (~> 3.5.0)
|
36
|
+
rspec-support (3.5.0)
|
37
|
+
thread_safe (0.3.5)
|
38
|
+
tzinfo (1.2.2)
|
39
|
+
thread_safe (~> 0.1)
|
40
|
+
|
41
|
+
PLATFORMS
|
42
|
+
ruby
|
43
|
+
|
44
|
+
DEPENDENCIES
|
45
|
+
bundler (~> 1.13)
|
46
|
+
rack-action_logger!
|
47
|
+
rake (~> 10.0)
|
48
|
+
rspec (~> 3.0)
|
49
|
+
|
50
|
+
BUNDLED WITH
|
51
|
+
1.13.6
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Koichi Ishida
|
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.md
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
# Rack::ActionLogger
|
2
|
+
|
3
|
+
**Rack::ActionLogger** is a tool to collect user action logs via fluentd, Rails.logger or any custome logger.
|
4
|
+
|
5
|
+
It is intended to collect user request log, action log and any other custome logs.
|
6
|
+
|
7
|
+
**Rails 4 or Rails 5** is required to use it.
|
8
|
+
|
9
|
+
## Sample Logs
|
10
|
+
|
11
|
+
![sample logs](docs/sample_log.png)
|
12
|
+
|
13
|
+
Under example folder, there are sample Rails applications to see how these sample logs are created.
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
Add this line to your rails application's Gemfile:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem 'rack-action_logger'
|
21
|
+
gem 'fluent-logger'
|
22
|
+
```
|
23
|
+
|
24
|
+
And then execute:
|
25
|
+
|
26
|
+
$ bundle
|
27
|
+
|
28
|
+
Then, add Rack::ActionLogger as middleware to config/application.rb.
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
config.middleware.use Rack::ActionLogger
|
32
|
+
```
|
33
|
+
|
34
|
+
Under config/initializers, add the following files.
|
35
|
+
^^
|
36
|
+
### fluent_logger.rb
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
Fluent::Logger::FluentLogger.open
|
40
|
+
```
|
41
|
+
|
42
|
+
### rack-action_logger.rb
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
Rack::ActionLogger.configure do |config|
|
46
|
+
config.emit_adapter = Rack::ActionLogger::EmitAdapter::FluentAdapter
|
47
|
+
config.wrap_key = :message
|
48
|
+
config.logger = Rails.logger
|
49
|
+
end
|
50
|
+
```
|
51
|
+
|
52
|
+
If wrap_key is nil, the out put does not have parent key of wrap_key.
|
53
|
+
|
54
|
+
## Usage
|
55
|
+
|
56
|
+
### Enable Request Log
|
57
|
+
|
58
|
+
Add the following code to 'app/controllers/application_controller.rb'.
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
include Rack::ActionLogger::ControllerConcerns::RequestLog
|
62
|
+
```
|
63
|
+
|
64
|
+
Request log should looks like this.
|
65
|
+
|
66
|
+
![request logs](docs/request_log.png)
|
67
|
+
|
68
|
+
Request can be customized by creating new request log concern.
|
69
|
+
|
70
|
+
|
71
|
+
### Add Append Log
|
72
|
+
|
73
|
+
Add the following code to any code on any times.
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
Rack::ActionLogger::Container.set_append_log({ value: 'ok' }, 'action.activities')
|
77
|
+
```
|
78
|
+
|
79
|
+
Action log should looks like this.
|
80
|
+
|
81
|
+
![action log](docs/action_log.png)
|
82
|
+
|
83
|
+
### Override log attributes
|
84
|
+
|
85
|
+
Overriden attributes are added to both request and append logs.
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
Rack::ActionLogger::Container.merge_attributes({ user_id: 123 })
|
89
|
+
```
|
90
|
+
|
91
|
+
![attributed log](docs/attributed_log.png)
|
92
|
+
|
93
|
+
|
94
|
+
## Development
|
95
|
+
|
96
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
97
|
+
|
98
|
+
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`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
99
|
+
|
100
|
+
## Contributing
|
101
|
+
|
102
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/wapa5pow/rack-action_logger. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
103
|
+
|
104
|
+
|
105
|
+
## License
|
106
|
+
|
107
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
108
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rack/action_logger"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/rspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'rspec' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/bin/setup
ADDED
data/docs/action_log.png
ADDED
Binary file
|
Binary file
|
Binary file
|
data/docs/sample_log.png
ADDED
Binary file
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
+
You are allowed to:
|
4
|
+
1. Reorder generators
|
5
|
+
2. Remove generators
|
6
|
+
3. Add installed generators
|
7
|
+
To add new installed generators automatically delete this file and reload the project.
|
8
|
+
--><GeneratorsGroup><Generator name="assets" /><Generator name="coffee:assets" /><Generator name="controller" /><Generator name="generator" /><Generator name="helper" /><Generator name="integration_test" /><Generator name="jbuilder" /><Generator name="job" /><Generator name="js:assets" /><Generator name="mailer" /><Generator name="migration" /><Generator name="model" /><Generator name="resource" /><Generator name="scaffold" /><Generator name="scaffold_controller" /><Generator name="task" /><Generator name="test_unit:controller" /><Generator name="test_unit:generator" /><Generator name="test_unit:helper" /><Generator name="test_unit:integration" /><Generator name="test_unit:job" /><Generator name="test_unit:mailer" /><Generator name="test_unit:model" /><Generator name="test_unit:plugin" /><Generator name="test_unit:scaffold" /></GeneratorsGroup></Settings>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
|
2
|
+
# Created by https://www.gitignore.io/api/rails
|
3
|
+
|
4
|
+
### Rails ###
|
5
|
+
*.rbc
|
6
|
+
capybara-*.html
|
7
|
+
.rspec
|
8
|
+
/log
|
9
|
+
/tmp
|
10
|
+
/db/*.sqlite3
|
11
|
+
/db/*.sqlite3-journal
|
12
|
+
/public/system
|
13
|
+
/coverage/
|
14
|
+
/spec/tmp
|
15
|
+
**.orig
|
16
|
+
rerun.txt
|
17
|
+
pickle-email-*.html
|
18
|
+
|
19
|
+
# TODO Comment out this rule if you are OK with secrets being uploaded to the repo
|
20
|
+
config/initializers/secret_token.rb
|
21
|
+
|
22
|
+
# Only include if you have production secrets in this file, which is no longer a Rails default
|
23
|
+
# config/secrets.yml
|
24
|
+
|
25
|
+
# dotenv
|
26
|
+
# TODO Comment out this rule if environment variables can be committed
|
27
|
+
.env
|
28
|
+
|
29
|
+
## Environment normalization:
|
30
|
+
/.bundle
|
31
|
+
/vendor/bundle
|
32
|
+
|
33
|
+
# these should all be checked in to normalize the environment:
|
34
|
+
# Gemfile.lock, .ruby-version, .ruby-gemset
|
35
|
+
|
36
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
37
|
+
.rvmrc
|
38
|
+
|
39
|
+
# if using bower-rails ignore default bower_components path bower.json files
|
40
|
+
/vendor/assets/bower_components
|
41
|
+
*.bowerrc
|
42
|
+
bower.json
|
43
|
+
|
44
|
+
# Ignore pow environment settings
|
45
|
+
.powenv
|
46
|
+
|
47
|
+
# Ignore Byebug command history file.
|
48
|
+
.byebug_history
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
+
You are allowed to:
|
4
|
+
1. Remove rake task
|
5
|
+
2. Add existing rake tasks
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Install developed gem
|
4
|
+
gem 'rack-action_logger', path: '../..'
|
5
|
+
|
6
|
+
gem 'fluent-logger'
|
7
|
+
|
8
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
9
|
+
gem 'rails', '4.2.7.1'
|
10
|
+
# Use sqlite3 as the database for Active Record
|
11
|
+
gem 'sqlite3'
|
12
|
+
# Use SCSS for stylesheets
|
13
|
+
gem 'sass-rails', '~> 5.0'
|
14
|
+
# Use Uglifier as compressor for JavaScript assets
|
15
|
+
gem 'uglifier', '>= 1.3.0'
|
16
|
+
# Use CoffeeScript for .coffee assets and views
|
17
|
+
gem 'coffee-rails', '~> 4.1.0'
|
18
|
+
# See https://github.com/rails/execjs#readme for more supported runtimes
|
19
|
+
# gem 'therubyracer', platforms: :ruby
|
20
|
+
|
21
|
+
# Use jquery as the JavaScript library
|
22
|
+
gem 'jquery-rails'
|
23
|
+
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
24
|
+
gem 'turbolinks'
|
25
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
26
|
+
gem 'jbuilder', '~> 2.0'
|
27
|
+
# bundle exec rake doc:rails generates the API under doc/api.
|
28
|
+
gem 'sdoc', '~> 0.4.0', group: :doc
|
29
|
+
|
30
|
+
# Use ActiveModel has_secure_password
|
31
|
+
# gem 'bcrypt', '~> 3.1.7'
|
32
|
+
|
33
|
+
# Use Unicorn as the app server
|
34
|
+
# gem 'unicorn'
|
35
|
+
|
36
|
+
# Use Capistrano for deployment
|
37
|
+
# gem 'capistrano-rails', group: :development
|
38
|
+
|
39
|
+
group :development, :test do
|
40
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
41
|
+
gem 'byebug'
|
42
|
+
|
43
|
+
gem 'rspec-rails'
|
44
|
+
end
|
45
|
+
|
46
|
+
group :development do
|
47
|
+
# Access an IRB console on exception pages or by using <%= console %> in views
|
48
|
+
gem 'web-console', '~> 2.0'
|
49
|
+
|
50
|
+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
51
|
+
gem 'spring'
|
52
|
+
end
|
53
|
+
|