chihiro 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19a0c1588e96239af86932d782fde853c350ed8ddb7eee1d878a00551e0ed96a
4
- data.tar.gz: 7c38262b300d98a138bb51e833a71da78eedfd6e03e83aba157aac974bb48c8f
3
+ metadata.gz: dfc59219e6e8b0f766857bc56113c0d971a6026b3cdf26ebc50980db456d4eb0
4
+ data.tar.gz: 2acdfe54c7b817bfb3bdcc923574a2513c1141e0aecdb3022e66c20d6650931f
5
5
  SHA512:
6
- metadata.gz: c4e36a40c4c9d4e40749664808efa5419660a5573804ff27e35751dbcda02a14d1a214ce55c72c5f33962309d7ad19287d9882efa615eeb1ed4218473f406d98
7
- data.tar.gz: 3394d08f54bcbb7cba1dbde34f22a611317d8f5585708114ea2e46fe35424221477e27bac6f7bf5ee443f9e287ee9040ef843958d7a0b37222fa16ffa18bf13a
6
+ metadata.gz: a837de308e81d9421d681179366ded79038c7b477e544d918ce39d5bebd07b594c4c5f924ffd98354365aafbc220b81e6b6bb090dcb74e191f1ce55d2eab7538
7
+ data.tar.gz: 41f039b50250db652416cd2c624a10b9dc4e53b7e6e1267957118c3e387704bf093088d9f39e3d7ccae226ddbbe33cd4fc18a9caf40e9f58b8d7367536a003d7
@@ -20,12 +20,13 @@ module Chihiro
20
20
  def log_request
21
21
  to_log = {
22
22
  message: 'Received API request',
23
- requestPath: request.path
23
+ requestPath: request.path,
24
+ requestMethod: request.request_method
24
25
  }
25
26
  if Rails.configuration.no_log_param_paths.include?("#{controller_name}##{action_name}")
26
27
  Rails.logger.info(to_log)
27
28
  else
28
- Rails.logger.info(to_log.merge(params: params.as_json))
29
+ Rails.logger.info(to_log.merge(params: params.except(:format, :controller, :action).as_json))
29
30
  end
30
31
  end
31
32
 
@@ -33,6 +34,7 @@ module Chihiro
33
34
  to_log = {
34
35
  message: 'Send API Response',
35
36
  requestPath: request.path,
37
+ requestMethod: request.request_method,
36
38
  responseStatus: response.status.to_s
37
39
  }
38
40
  Rails.logger.info(to_log)
@@ -42,6 +44,7 @@ module Chihiro
42
44
  to_log = {
43
45
  message: 'Catched exception in controller',
44
46
  requestPath: request.path,
47
+ requestMethod: request.request_method,
45
48
  exceptionClass: e.class.to_s,
46
49
  exceptionMessage: e.message,
47
50
  backtrace: e.backtrace
@@ -21,6 +21,10 @@ module Chihiro
21
21
  lambda { |value| value.to_s.gsub(/./, '*') }
22
22
  end
23
23
 
24
+ def mask_email
25
+ lambda { |value| value.to_s.gsub(/(?<=.{3}).(?=[^@]*?@)/, '*') }
26
+ end
27
+
24
28
  def masks
25
29
  @all_masks ||= {
26
30
  'password' => mask_all_characters,
@@ -28,7 +32,9 @@ module Chihiro
28
32
  'token' => mask_all_characters,
29
33
  'otp' => mask_all_characters,
30
34
  'current_password' => mask_all_characters,
31
- 'new_password' => mask_all_characters
35
+ 'new_password' => mask_all_characters,
36
+ 'email' => mask_email,
37
+ 'user_email' => mask_email
32
38
  }
33
39
  end
34
40
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Chihiro
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chihiro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shu Hui
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-19 00:00:00.000000000 Z
11
+ date: 2018-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lograge
@@ -110,6 +110,7 @@ files:
110
110
  - pkg/chihiro-0.2.0.gem
111
111
  - pkg/chihiro-0.2.1.gem
112
112
  - pkg/chihiro-0.2.2.gem
113
+ - pkg/chihiro-0.3.0.gem
113
114
  - spec/chihiro_spec.rb
114
115
  - spec/mask_util_spec.rb
115
116
  - spec/spec_helper.rb