smarter_logging 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/smarter_logging.rb +1 -2
- data/lib/smarter_logging/controller_helper.rb +1 -1
- data/lib/smarter_logging/version.rb +1 -1
- data/smarter_logging.gemspec +2 -2
- metadata +15 -16
- data/lib/smarter_logging/extensions/string.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9a8278a6fad43149c602cc83a96a59d424b7804
|
4
|
+
data.tar.gz: 5ee8cd58d7517d4d51ca8b7ff4fd600014650e69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93cb43d413a4f58925ba4db4b5fcd9192f4ad11141297ebb8f3e39b97b72b9a95ddf28a73a1a9792d038d725df995a5d3332ad815b123121142d6469794d512c
|
7
|
+
data.tar.gz: 8beed74942970b536f3f12a8a37a1440e49504ae98a943d56876f22aefda987ea1babc5043b73be1929db968bebe4adcd473023ffcd1f22379d8f29d63eef526
|
data/lib/smarter_logging.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
require 'smarter_logging/version'
|
2
2
|
|
3
|
-
require 'smarter_logging/extensions/string'
|
4
|
-
|
5
3
|
require 'smarter_logging/base_logger'
|
6
4
|
require 'smarter_logging/anomaly_logger'
|
7
5
|
require 'smarter_logging/activity_logger'
|
@@ -9,6 +7,7 @@ require 'smarter_logging/controller_helper'
|
|
9
7
|
|
10
8
|
require 'smarter_logging/railtie' if defined?(Rails)
|
11
9
|
|
10
|
+
require 'securerandom'
|
12
11
|
|
13
12
|
module SmarterLogging
|
14
13
|
# Your code goes here...
|
@@ -9,7 +9,7 @@ module SmarterLogging
|
|
9
9
|
# Get some basic info from the current thread, and add it to the log parameters:
|
10
10
|
# The RequestID RQID can be passed-in on subsequent API-calls,
|
11
11
|
# so if several APIs call each other, they can be traced with the initial call's RQID
|
12
|
-
Thread.current[:rqid] = request.headers['X_RQID'] ||
|
12
|
+
Thread.current[:rqid] = request.headers['X_RQID'] || SecureRandom.hex(24)
|
13
13
|
Thread.current[:ip] = request.remote_ip || request.ip
|
14
14
|
Thread.current[:user_agent] = request.user_agent
|
15
15
|
end
|
data/smarter_logging.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.add_development_dependency "bundler"
|
25
|
-
spec.add_development_dependency "rake", "
|
24
|
+
spec.add_development_dependency "bundler"
|
25
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
26
26
|
spec.add_development_dependency "rspec", "~> 3.0"
|
27
27
|
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smarter_logging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tilo Sloboda
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 12.3.3
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 12.3.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,7 +73,6 @@ files:
|
|
73
73
|
- lib/smarter_logging/anomaly_logger.rb
|
74
74
|
- lib/smarter_logging/base_logger.rb
|
75
75
|
- lib/smarter_logging/controller_helper.rb
|
76
|
-
- lib/smarter_logging/extensions/string.rb
|
77
76
|
- lib/smarter_logging/railtie.rb
|
78
77
|
- lib/smarter_logging/version.rb
|
79
78
|
- smarter_logging.gemspec
|
@@ -81,7 +80,7 @@ homepage: https://github.com/tilo/smarter_logging
|
|
81
80
|
licenses:
|
82
81
|
- MIT
|
83
82
|
metadata: {}
|
84
|
-
post_install_message:
|
83
|
+
post_install_message:
|
85
84
|
rdoc_options: []
|
86
85
|
require_paths:
|
87
86
|
- lib
|
@@ -96,9 +95,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
95
|
- !ruby/object:Gem::Version
|
97
96
|
version: '0'
|
98
97
|
requirements: []
|
99
|
-
rubyforge_project:
|
100
|
-
rubygems_version: 2.
|
101
|
-
signing_key:
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 2.6.11
|
100
|
+
signing_key:
|
102
101
|
specification_version: 4
|
103
102
|
summary: Ruby Gem for smarter logging of key=value data
|
104
103
|
test_files: []
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module SmarterLogging
|
2
|
-
module Extensions
|
3
|
-
|
4
|
-
module String # adding functionality without monkey patching String
|
5
|
-
|
6
|
-
# Create a random String of given length, using given character set
|
7
|
-
#
|
8
|
-
# Character set is an Array which can contain Ranges, Arrays, Characters
|
9
|
-
#
|
10
|
-
# Examples
|
11
|
-
#
|
12
|
-
# String.random
|
13
|
-
# String.random(10, ['0'..'9','A'..'F'] )
|
14
|
-
# => "3EBF48AD3D"
|
15
|
-
#
|
16
|
-
# BASE64_CHAR_SET = ["A".."Z", "a".."z", "0".."9", '_', '-']
|
17
|
-
# String.random(10, BASE64_CHAR_SET)
|
18
|
-
# => "xM_1t3qcNn"
|
19
|
-
#
|
20
|
-
# SPECIAL_CHARS = ["!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-", "_", "=", "+", "|", "/", "?", ".", ",", ";", ":", "~", "`", "[", "]", "{", "}", "<", ">"]
|
21
|
-
# BASE91_CHAR_SET = ["A".."Z", "a".."z", "0".."9", SPECIAL_CHARS]
|
22
|
-
# String.random(10, BASE91_CHAR_SET)
|
23
|
-
# => "S(Z]z,J{v;"
|
24
|
-
#
|
25
|
-
# CREDIT: Tilo Sloboda
|
26
|
-
#
|
27
|
-
# SEE: https://gist.github.com/tilo/3ee8d94871d30416feba
|
28
|
-
|
29
|
-
def self.random(len=32, character_set = ["A".."Z", "a".."z", "0".."9"])
|
30
|
-
chars = character_set.map{|x| x.is_a?(Range) ? x.to_a : x }.flatten
|
31
|
-
Array.new(len){ chars.sample }.join
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|