evt-component_host 2.0.0.2 → 2.0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed6a1a9e2aabbcec1bf3257afab6c9b4d5a1d31f3c9518081ec43c1730c5b0ad
4
- data.tar.gz: d7e7410237454de16bd98e621172ae92aa46c191e6ccaefca6e65fb0da1b41c1
3
+ metadata.gz: fe3860498c92906fae576cca0b3754433fadc953dc61b6059c5309ab5251cb03
4
+ data.tar.gz: 54a233929c4a7dba272c923623d09d74675c3b4d2b8a1077d2b59eca3fbcf42a
5
5
  SHA512:
6
- metadata.gz: ec76631e3c75d4f117a5d73cb42b8162063feb2babfc8da6122a57d5c27aebb613ab4b68ba7d58f19c4a25d8a37c6ebca24e978eba7a0488efb72b93059ff97d
7
- data.tar.gz: ad73d7446f86f4ab36c90286f3c9977452e4f043ea0139bd0fccf1a5060c094f4d3d4cd4e5f927e252751e20dc957a0f5ad170699bf1fd685bfe95142ec74845
6
+ metadata.gz: 10c2b6e83b60c74e2bd5c740f9340d5aa2ad0dfde900a68cb9fd935e0fbc88950f7a31b908064a6e66431bc11548ea5809c3d0de7e0ecc35931c89e45cfddd3c
7
+ data.tar.gz: e53c53da40bb91e9d3bfeac37e5ba46ed2c70624808646fb4fabb7248761e64eacec8faa752665cf5068a7ca6cdf5329997bccd26fc69c9fb6cbdc9aaef65712
@@ -6,8 +6,78 @@ module ComponentHost
6
6
 
7
7
  host.instance_exec host, &block
8
8
 
9
+ if Defaults.env_var_info?
10
+ STDOUT.puts
11
+ STDOUT.puts "Environment Variables:"
12
+ STDOUT.puts " ENTITY_CACHE_SCOPE: #{ENV['ENTITY_CACHE_SCOPE'] || '(not set)'}"
13
+ STDOUT.puts " MESSAGE_STORE_SETTINGS_PATH: #{ENV['MESSAGE_STORE_SETTINGS_PATH'] || '(not set)'}"
14
+ STDOUT.puts " HANDLE_STRICT: #{ENV['HANDLE_STRICT'] || '(not set)'}"
15
+ STDOUT.puts " LOG_LEVEL: #{ENV['LOG_LEVEL'] || '(not set)'}"
16
+ STDOUT.puts " LOG_TAGS: #{ENV['LOG_TAGS'] || '(not set)'}"
17
+ STDOUT.puts " LOG_HEADER: #{ENV['LOG_HEADER'] || '(not set)'}"
18
+ STDOUT.puts " LOG_FORMATTERS: #{ENV['LOG_FORMATTERS'] || '(not set)'}"
19
+ STDOUT.puts " CONSOLE_DEVICE: #{ENV['CONSOLE_DEVICE'] || '(not set)'}"
20
+ STDOUT.puts " STARTUP_INFO: #{ENV['STARTUP_INFO'] || '(not set)'}"
21
+ STDOUT.puts " ENV_VAR_INFO: #{ENV['ENV_VAR_INFO'] || '(not set)'}"
22
+ end
23
+
24
+ if Defaults.startup_info?
25
+ STDOUT.puts
26
+ STDOUT.puts "Host: #{name}"
27
+ end
28
+ logger.info(tags: [:component_host, :start, :lifecycle]) { "Starting host: #{name} (Process ID: #{::Process.pid})" }
29
+
30
+ if Defaults.startup_info?
31
+ STDOUT.puts
32
+ end
33
+
9
34
  host.start do
10
- logger.info(tags: [:*, :component, :start, :lifecycle]) { "Started: #{name} (ProcessID: #{::Process.pid})" }
35
+ if Defaults.startup_info?
36
+ STDOUT.puts
37
+ STDOUT.puts "Host running: #{name}"
38
+ STDOUT.puts "Process ID: #{::Process.pid}"
39
+ STDOUT.puts
40
+ end
41
+
42
+ logger.info(tags: [:component_host, :start, :lifecycle]) { "Started host: #{name} (Process ID: #{::Process.pid})" }
43
+ end
44
+ end
45
+
46
+ module Defaults
47
+ def self.startup_info?
48
+ StartupInfo.get == 'on'
49
+ end
50
+
51
+ def self.env_var_info?
52
+ EnvVarInfo.get == 'on'
53
+ end
54
+
55
+ module StartupInfo
56
+ def self.get
57
+ ENV.fetch(env_var, default)
58
+ end
59
+
60
+ def self.env_var
61
+ 'STARTUP_INFO'
62
+ end
63
+
64
+ def self.default
65
+ 'on'
66
+ end
67
+ end
68
+
69
+ module EnvVarInfo
70
+ def self.get
71
+ ENV.fetch(env_var, default)
72
+ end
73
+
74
+ def self.env_var
75
+ 'ENV_VAR_INFO'
76
+ end
77
+
78
+ def self.default
79
+ 'on'
80
+ end
11
81
  end
12
82
  end
13
83
  end
@@ -16,13 +16,13 @@ module ComponentHost
16
16
  def register(initiator, name=nil, &block)
17
17
  initiator ||= proc { yield }
18
18
 
19
- logger.trace { "Registering component (Component Initiator: #{initiator}, Name: #{name || '(none)'})" }
19
+ logger.trace(tag: :component_host) { "Registering component (Component Initiator: #{initiator}, Name: #{name || '(none)'})" }
20
20
 
21
21
  component = Component.new initiator, name
22
22
 
23
23
  components << component
24
24
 
25
- logger.debug { "Registered component (Component Initiator: #{initiator}, Name: #{name || '(none)'})" }
25
+ logger.debug(tag: :component_host) { "Registered component (Component Initiator: #{initiator}, Name: #{name || '(none)'})" }
26
26
 
27
27
  component
28
28
  end
@@ -83,16 +83,22 @@ module ComponentHost
83
83
 
84
84
  def start_components(&block)
85
85
  components.each do |component|
86
- logger.info(tag: :*) { "Starting component: #{component.initiator} (Name: #{component.name || '(none)'})" }
86
+ if ComponentHost::Defaults.startup_info?
87
+ STDOUT.puts " Component: #{component.initiator} (Name: #{component.name || '(none)'})"
88
+ end
89
+
90
+ logger.trace(tags: [:component_host, :start]) { "Starting component: #{component.initiator} (Name: #{component.name || '(none)'})" }
91
+
87
92
  component.start
88
- logger.info(tag: :*) { "Started component: #{component.initiator} (Name: #{component.name || '(none)'})" }
93
+
94
+ logger.info(tags: [:component_host, :start]) { "Started component: #{component.initiator} (Name: #{component.name || '(none)'})" }
89
95
 
90
96
  block.(component) if block
91
97
  end
92
98
 
93
99
  rescue => error
94
100
  record_errors_observer.(error)
95
- logger.fatal(tags: [:*, :component, :lifecycle]) { "#{error.message} (Error: #{error.class})" }
101
+ logger.fatal(tags: [:*, :component_host, :start]) { "#{error.message} (Error: #{error.class})" }
96
102
  raise error
97
103
  end
98
104
 
@@ -5,17 +5,17 @@ module ComponentHost
5
5
  include ComponentHost::Log::Dependency
6
6
 
7
7
  handle Actor::Messages::ActorStarted do |msg|
8
- logger.debug(tags: [:actor, :lifecycle, :start]) { "Actor started (Address: #{msg.address.id}, Actor: #{msg.actor.digest})" }
8
+ logger.debug(tags: [:component_host, :actor, :lifecycle, :start]) { "Actor started (Address: #{msg.address.id}, Actor: #{msg.actor.digest})" }
9
9
  end
10
10
 
11
11
  handle Actor::Messages::ActorStopped do |msg|
12
- logger.debug(tags: [:actor, :lifecycle, :stop]) { "Actor stopped (Address: #{msg.address.id}, Actor: #{msg.actor.digest})" }
12
+ logger.debug(tags: [:component_host, :actor, :lifecycle, :stop]) { "Actor stopped (Address: #{msg.address.id}, Actor: #{msg.actor.digest})" }
13
13
  end
14
14
 
15
15
  handle Actor::Messages::ActorCrashed do |msg|
16
16
  error = msg.error
17
17
 
18
- logger.error(tags: [:actor, :lifecycle, :stop, :crash]) { "Error raised (Error: #{error.class.name}, Actor: #{msg.actor.digest}, Message: #{error.message.inspect})" }
18
+ logger.error(tags: [:component_host, :actor, :lifecycle, :stop, :crash]) { "Error raised (Error: #{error.class.name}, Actor: #{msg.actor.digest}, Message: #{error.message.inspect})" }
19
19
  end
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-component_host
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.2
4
+ version: 2.0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-10 00:00:00.000000000 Z
11
+ date: 2020-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ntl-actor
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  - !ruby/object:Gem::Version
135
135
  version: '0'
136
136
  requirements: []
137
- rubygems_version: 3.0.1
137
+ rubygems_version: 3.1.2
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: Host components inside a single physical process