testa_logger 0.1.19 → 0.1.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/lib/testa_logger/logger/dispatcher.rb +4 -2
- data/lib/testa_logger/logger.rb +16 -8
- data/lib/testa_logger/version.rb +1 -1
- data/lib/testa_logger.rb +1 -0
- data/logger.iml +7 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff7ad4e5fb128b752065e10155a436d3c897561744f985bc671a65a1b92f2a50
|
4
|
+
data.tar.gz: 672aa0754bde18448acc847ca3e5d82f63ed4bca7c1cfad6e9d697d978c283a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 504beb57cb3a52a14f60643b6ee9e51ce5d1e59282d248ccf9714229bf1f4de252262ebd07215f7e7b3a0f3d7a4e6ec3595fb241188c75de1d461493d2aa9f11
|
7
|
+
data.tar.gz: 989341c9df47cfcc9c7eecc6159a4a0288b258b6384f049b3801b99d0758cefbdf4b9cded7e8d398ea0b03fc3720b0f79ac518cd9d146f358f97c90d13b7bb3d
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
testa_logger (0.1.
|
4
|
+
testa_logger (0.1.22)
|
5
5
|
activesupport
|
6
6
|
awesome_print
|
7
7
|
aws-sdk-s3
|
@@ -21,8 +21,8 @@ GEM
|
|
21
21
|
ast (2.4.2)
|
22
22
|
awesome_print (1.9.2)
|
23
23
|
aws-eventstream (1.2.0)
|
24
|
-
aws-partitions (1.
|
25
|
-
aws-sdk-core (3.
|
24
|
+
aws-partitions (1.620.0)
|
25
|
+
aws-sdk-core (3.132.0)
|
26
26
|
aws-eventstream (~> 1, >= 1.0.2)
|
27
27
|
aws-partitions (~> 1, >= 1.525.0)
|
28
28
|
aws-sigv4 (~> 1.1)
|
@@ -17,12 +17,12 @@ module TestaLogger
|
|
17
17
|
@channel += "/#{logger.subgroup}" unless logger.subgroup.nil?
|
18
18
|
@outbox = Concurrent::Array.new
|
19
19
|
run_dispatch_thread
|
20
|
-
at_exit { dispatch }
|
20
|
+
at_exit { dispatch if @outbox.count.positive? }
|
21
21
|
end
|
22
22
|
|
23
23
|
def push(level, time, tag, message, log)
|
24
24
|
# after forking process, dispatch thread will stop working in the forked process
|
25
|
-
run_dispatch_thread if @
|
25
|
+
run_dispatch_thread if @pid.nil? || @pid != Process.pid
|
26
26
|
|
27
27
|
data = {
|
28
28
|
app: logger.app,
|
@@ -38,6 +38,8 @@ module TestaLogger
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def run_dispatch_thread
|
41
|
+
@pid = Process.pid
|
42
|
+
|
41
43
|
@dispatch_thread = Thread.new do
|
42
44
|
max_delay = 0.5
|
43
45
|
max_buffer = 20
|
data/lib/testa_logger/logger.rb
CHANGED
@@ -42,6 +42,7 @@ module TestaLogger
|
|
42
42
|
setup_dispatcher
|
43
43
|
start_write_thread
|
44
44
|
init_s3_client if @options.persist
|
45
|
+
at_exit { flush_queue }
|
45
46
|
end
|
46
47
|
|
47
48
|
def create_log_file
|
@@ -65,17 +66,24 @@ module TestaLogger
|
|
65
66
|
end
|
66
67
|
|
67
68
|
def start_write_thread
|
69
|
+
@pid = Process.pid
|
68
70
|
# we must use this queue in order to be able to collect logs in trap context
|
69
71
|
@queue = Queue.new
|
70
72
|
@write_thread = Thread.new do
|
71
|
-
loop
|
72
|
-
text = @queue.pop
|
73
|
-
Thread.stop if Thread.current["stop"]
|
74
|
-
@log_device.write(text)
|
75
|
-
end
|
73
|
+
loop { queue_pop }
|
76
74
|
end
|
77
75
|
end
|
78
76
|
|
77
|
+
def flush_queue
|
78
|
+
queue_pop while @queue.size.positive?
|
79
|
+
end
|
80
|
+
|
81
|
+
def queue_pop
|
82
|
+
text = @queue.pop
|
83
|
+
Thread.stop if Thread.current["stop"]
|
84
|
+
@log_device.write(text)
|
85
|
+
end
|
86
|
+
|
79
87
|
def formatter
|
80
88
|
options.formatter
|
81
89
|
end
|
@@ -192,15 +200,15 @@ module TestaLogger
|
|
192
200
|
log = format_message(formatted_severity, time, "", tag_and_message)
|
193
201
|
|
194
202
|
# after forking process, write thread will stop working in the forked process
|
195
|
-
start_write_thread if @
|
203
|
+
start_write_thread if @pid.nil? || @pid != Process.pid
|
196
204
|
@queue << log
|
197
205
|
@dispatcher.push(level, time, tag, message, log) if options.live
|
198
206
|
return unless options.stdout
|
199
207
|
|
200
208
|
if level >= ERROR
|
201
|
-
|
209
|
+
$stderr.puts(log) # rubocop:disable Style/StderrPuts
|
202
210
|
else
|
203
|
-
puts
|
211
|
+
$stdout.puts(log)
|
204
212
|
end
|
205
213
|
end
|
206
214
|
|
data/lib/testa_logger/version.rb
CHANGED
data/lib/testa_logger.rb
CHANGED
data/logger.iml
CHANGED
@@ -11,8 +11,8 @@
|
|
11
11
|
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
12
12
|
<orderEntry type="library" scope="PROVIDED" name="awesome_print (v1.9.2, RVM: ruby-2.7.6) [gem]" level="application" />
|
13
13
|
<orderEntry type="library" scope="PROVIDED" name="aws-eventstream (v1.2.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
14
|
-
<orderEntry type="library" scope="PROVIDED" name="aws-partitions (v1.
|
15
|
-
<orderEntry type="library" scope="PROVIDED" name="aws-sdk-core (v3.
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="aws-partitions (v1.620.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="aws-sdk-core (v3.132.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
16
16
|
<orderEntry type="library" scope="PROVIDED" name="aws-sdk-kms (v1.58.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
17
17
|
<orderEntry type="library" scope="PROVIDED" name="aws-sdk-s3 (v1.114.0, RVM: ruby-2.7.6) [gem]" level="application" />
|
18
18
|
<orderEntry type="library" scope="PROVIDED" name="aws-sigv4 (v1.5.1, RVM: ruby-2.7.6) [gem]" level="application" />
|
@@ -42,21 +42,21 @@
|
|
42
42
|
<option name="myRootTask">
|
43
43
|
<RakeTaskImpl id="rake">
|
44
44
|
<subtasks>
|
45
|
-
<RakeTaskImpl description="Build testa_logger-0.1.
|
45
|
+
<RakeTaskImpl description="Build testa_logger-0.1.21.gem into the pkg directory" fullCommand="build" id="build" />
|
46
46
|
<RakeTaskImpl id="build">
|
47
47
|
<subtasks>
|
48
|
-
<RakeTaskImpl description="Generate SHA512 checksum if testa_logger-0.1.
|
48
|
+
<RakeTaskImpl description="Generate SHA512 checksum if testa_logger-0.1.21.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
|
49
49
|
</subtasks>
|
50
50
|
</RakeTaskImpl>
|
51
51
|
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
52
52
|
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
53
|
-
<RakeTaskImpl description="Build and install testa_logger-0.1.
|
53
|
+
<RakeTaskImpl description="Build and install testa_logger-0.1.21.gem into system gems" fullCommand="install" id="install" />
|
54
54
|
<RakeTaskImpl id="install">
|
55
55
|
<subtasks>
|
56
|
-
<RakeTaskImpl description="Build and install testa_logger-0.1.
|
56
|
+
<RakeTaskImpl description="Build and install testa_logger-0.1.21.gem into system gems without network access" fullCommand="install:local" id="local" />
|
57
57
|
</subtasks>
|
58
58
|
</RakeTaskImpl>
|
59
|
-
<RakeTaskImpl description="Create tag v0.1.
|
59
|
+
<RakeTaskImpl description="Create tag v0.1.21 and build and push testa_logger-0.1.21.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
|
60
60
|
<RakeTaskImpl description="Run tests" fullCommand="test" id="test" />
|
61
61
|
<RakeTaskImpl description="" fullCommand="default" id="default" />
|
62
62
|
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testa_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- karlo.razumovic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|