RTALogger 0.1.1 → 0.1.2

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: 5cd821ed8beebbda5bfd6aff1088372642f5f20012c7f5d6ca8b2d59cc8dee42
4
- data.tar.gz: 8dbf6b01f03b98525acade15eaebece1e500dfbc610f2d9cbda5e760df0e048b
3
+ metadata.gz: 9d28795fc1ab81da8fe17aea8489d11559cd05d06caa7545a30ac5abcda1e5eb
4
+ data.tar.gz: 5bd61d89f1d4ec087294845f742c4799c3899590adae9366ab013f67a30924cf
5
5
  SHA512:
6
- metadata.gz: 7a1e77c33e3fb301780bb6d4a0b254701ab918403ee8705e19bda759b2c0ce56b1e1cf76c18012c195b5c3b28267dea524bbe3db303f7a9fb9dca58662fe9a2f
7
- data.tar.gz: fd81ab07bb1a3c79e00e425298068e4cfa357208e4173f157a156e5cdefcb044f456604cfc0c3b9d0f37342e672d47636ffd75ceb4b5ef866a47f8f7db9bc7aa
6
+ metadata.gz: a0264ccb95941af08eb9ea0be0019a03e7151e7f5eb8a570fec66c421ebc8f031df7e3ac712aec515c603c66996d1c6976d95d1e4a1326be20c4946fb9ebcb22
7
+ data.tar.gz: 62ad72d8e5443de241cff8c9c8fc30c34006dd8fbae052f5388a275ecfea104b42a6225f5eb358df774a1811c7c64a4b0527b86120a6e9e505f8be0e09a2523c
@@ -10,10 +10,8 @@
10
10
  <orderEntry type="library" scope="PROVIDED" name="activesupport (v6.0.3.4, ruby-2.6.3-p62) [gem]" level="application" />
11
11
  <orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, ruby-2.6.3-p62) [gem]" level="application" />
12
12
  <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.7, ruby-2.6.3-p62) [gem]" level="application" />
13
- <orderEntry type="library" scope="PROVIDED" name="cool.io (v1.7.0, ruby-2.6.3-p62) [gem]" level="application" />
14
13
  <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.4.4, ruby-2.6.3-p62) [gem]" level="application" />
15
- <orderEntry type="library" scope="PROVIDED" name="fluentd (v1.11.4, ruby-2.6.3-p62) [gem]" level="application" />
16
- <orderEntry type="library" scope="PROVIDED" name="http_parser.rb (v0.6.0, ruby-2.6.3-p62) [gem]" level="application" />
14
+ <orderEntry type="library" scope="PROVIDED" name="fluent-logger (v0.9.0, ruby-2.6.3-p62) [gem]" level="application" />
17
15
  <orderEntry type="library" scope="PROVIDED" name="i18n (v1.8.5, ruby-2.6.3-p62) [gem]" level="application" />
18
16
  <orderEntry type="library" scope="PROVIDED" name="jbuilder (v2.10.1, ruby-2.6.3-p62) [gem]" level="application" />
19
17
  <orderEntry type="library" scope="PROVIDED" name="minitest (v5.14.2, ruby-2.6.3-p62) [gem]" level="application" />
@@ -24,13 +22,8 @@
24
22
  <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.10.0, ruby-2.6.3-p62) [gem]" level="application" />
25
23
  <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.10.0, ruby-2.6.3-p62) [gem]" level="application" />
26
24
  <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.10.0, ruby-2.6.3-p62) [gem]" level="application" />
27
- <orderEntry type="library" scope="PROVIDED" name="serverengine (v2.2.2, ruby-2.6.3-p62) [gem]" level="application" />
28
- <orderEntry type="library" scope="PROVIDED" name="sigdump (v0.2.4, ruby-2.6.3-p62) [gem]" level="application" />
29
- <orderEntry type="library" scope="PROVIDED" name="strptime (v0.2.5, ruby-2.6.3-p62) [gem]" level="application" />
30
25
  <orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, ruby-2.6.3-p62) [gem]" level="application" />
31
26
  <orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.7, ruby-2.6.3-p62) [gem]" level="application" />
32
- <orderEntry type="library" scope="PROVIDED" name="tzinfo-data (v1.2020.4, ruby-2.6.3-p62) [gem]" level="application" />
33
- <orderEntry type="library" scope="PROVIDED" name="yajl-ruby (v1.4.1, ruby-2.6.3-p62) [gem]" level="application" />
34
27
  <orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.4.1, ruby-2.6.3-p62) [gem]" level="application" />
35
28
  </component>
36
29
  </module>
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- RTALogger (0.1.1)
5
- fluentd (~> 1.11, >= 1.11.4)
4
+ RTALogger (0.1.2)
5
+ fluent-logger (~> 0.9)
6
6
  jbuilder (~> 2.10)
7
7
 
8
8
  GEM
@@ -15,19 +15,9 @@ GEM
15
15
  tzinfo (~> 1.1)
16
16
  zeitwerk (~> 2.2, >= 2.2.2)
17
17
  concurrent-ruby (1.1.7)
18
- cool.io (1.7.0)
19
18
  diff-lcs (1.4.4)
20
- fluentd (1.11.4)
21
- cool.io (>= 1.4.5, < 2.0.0)
22
- http_parser.rb (>= 0.5.1, < 0.7.0)
23
- msgpack (>= 1.3.1, < 2.0.0)
24
- serverengine (>= 2.0.4, < 3.0.0)
25
- sigdump (~> 0.2.2)
26
- strptime (>= 0.2.2, < 1.0.0)
27
- tzinfo (>= 1.0, < 3.0)
28
- tzinfo-data (~> 1.0)
29
- yajl-ruby (~> 1.0)
30
- http_parser.rb (0.6.0)
19
+ fluent-logger (0.9.0)
20
+ msgpack (>= 1.0.0, < 2)
31
21
  i18n (1.8.5)
32
22
  concurrent-ruby (~> 1.0)
33
23
  jbuilder (2.10.1)
@@ -48,16 +38,9 @@ GEM
48
38
  diff-lcs (>= 1.2.0, < 2.0)
49
39
  rspec-support (~> 3.10.0)
50
40
  rspec-support (3.10.0)
51
- serverengine (2.2.2)
52
- sigdump (~> 0.2.2)
53
- sigdump (0.2.4)
54
- strptime (0.2.5)
55
41
  thread_safe (0.3.6)
56
42
  tzinfo (1.2.7)
57
43
  thread_safe (~> 0.1)
58
- tzinfo-data (1.2020.4)
59
- tzinfo (>= 1.0.0)
60
- yajl-ruby (1.4.1)
61
44
  zeitwerk (2.4.1)
62
45
 
63
46
  PLATFORMS
data/README.md CHANGED
@@ -1,8 +1,28 @@
1
1
  # RTALogger
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/RTALogger`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ RTA Log Manager has been designed and implemented to provide standard logging API for developers.
4
+ This prevents chaos in log data format.
5
+ Also provide multiple extendable log repositories including wrapping existing loggers, like 'Fluentd' or implement completely new custom logger.
6
+ All log manager's main features are configable through a json config file.
4
7
 
5
- TODO: Delete this and the text above, and describe your gem
8
+ Main purposes of developing this gem are:
9
+ - Creating easy to use logger interface.
10
+ - Apply some rules and restrictions about log structure and data format, which prevents chaos in application log information.
11
+ - No interrupt or wait time for log consumer modules.
12
+ - Utilize multiple log repositories at the same time in background (Console, File, UDP, FluentD, etc.)
13
+ - Make it possible to implement customized log repositories.
14
+
15
+ Main Features:
16
+ - Creating multiple log manager instances with different configuration is possible entire application.
17
+ - Each log manager instance could be configured via a json file.
18
+ - Each log manager instance could be config to use multiple log repositories such as Console, File, UDP, Fluentd.
19
+ - Runtime configurations could be applied through log manager APIs.
20
+ - By using multi threading techniques and also buffering techniques,
21
+ all logging process will handled in seperated thread.
22
+ So the log consumer modules should not be wait for log manager to finish the logging task.
23
+ - Multiple standard log severity levels are available through topic APIs (debug, info, warning, error, fatal, unknown)
24
+ - Main features could be set and manipulate through json configuration file.
25
+ - And at the end, it is easy to use for ruby backend developers.
6
26
 
7
27
  ## Installation
8
28
 
@@ -20,45 +40,213 @@ Or install it yourself as:
20
40
 
21
41
  $ gem install RTALogger
22
42
 
43
+ To add gem to your rails application:
44
+
45
+ $ bundle add RTALogger
46
+
23
47
  ## Usage
48
+ #### RTA Log Data Structure
49
+ To use log manager APIs, first step is to have a quick review on Log Data Structure
50
+ - Application: The root of each log data record is Application, which specify the log data owner application.
51
+ - Topic: By adding multiple topics to log manager you can categorize log data in logical topics.
52
+ - Context: Under each topic, one or multiple contexts (in one level) could be defined.
53
+ - As an instance the Application could by 'MyEShopApp', one of Topics could be 'Authentication' and
54
+ Contexts could be 'uer_name' which attend in application authorization process.
55
+ - The next step is log severity level, which determines that the log record severity (debug, information, warning, error, fatal, unknown)
56
+ - At last the final element is log message, which contains log message data.
24
57
 
25
- require_relative 'log_factory_manager'
26
- require_relative 'log_factory_repository'
27
-
28
- controller_name = 'test_controller'
29
- userID = 5
30
-
31
- # create log manager instance
32
- # this could be a global variable declared in application level
33
- log_manager = RTALogger::LogFactory.log_manager_instance
58
+ ### Which Log Severity Levels to use
59
+ - DEBUG = 0 : Low-level information, mostly for developers.
60
+ - INFO = 1 : Generic (useful) information about system operation.
61
+ - WARN = 2 : A warning, which it does NOT cause crashing the process.
62
+ - ERROR = 3 : A handleable error condition.
63
+ - FATAL = 4 : An un-handleable error that results in a program crash.
64
+ - UNKNOWN = 5 : An unknown message that should always be logged.
65
+
66
+ ### Time for coding
67
+ - create log manager instance:
68
+ ```ruby
69
+ # add required files
70
+ require 'log_factory_manager'
34
71
 
35
- # set log manage application name (hard code)
36
- log_manager.app_name = 'myTestApp'
72
+ # create log manager instance using LogFactory
73
+ log_manager = RTALogger::LogFactory.log_manager_instance
74
+ ```
75
+ - Apply configuration using json config file
76
+ ```ruby
77
+ # the parameter is the json config file
78
+ log_manager.config_use_json_file('rta_logger_config.json')
79
+ ```
80
+ - Add new topic to log manager and get the topic instance
81
+ ```ruby
82
+ # the parameter is the topic name
83
+ # if add_topic API called multiple times with same parameter,
84
+ # only one instance will be created for that topic
85
+ topic = log_manager.add_topic('Authentication')
86
+ ```
87
+ - Finally add log message using topic instance
88
+ ```ruby
89
+ # Assume user 'Tom' is trying to authenticate we will use user_name as log Context_id
90
+ user_name = 'Tom'
91
+ topic = log_manager.add_topic('Authentication')
92
+ topic.debug(user_name, 'use_id is nil for user:', user_name)
93
+ topic.info(user_name, 'User ', user_name , ' is trying to login.')
94
+ topic.warning(user_name, 'Authentication failed for user ', user_name)
95
+ topic.error(user_name, 'Error connecting to data base for user ', user_name)
96
+ topic.fatal(user_name, 'Authentication service has been stopped working')
97
+ topic.unknown(user_name, 'An unknown error occured during authentication. user name:', user_name)
98
+ ```
99
+ the result will be:
100
+ ```
101
+ {"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":0,"message":"user_id is nil for user: Tom"}
102
+ {"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":1,"message":"User Tom is trying to login"}
103
+ {"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":2,"message":"Authentication failed for user Tom"}
104
+ {"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":3,"message":"Error connecting to data base for user Tom"}
105
+ {"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":4,"message":"Authentication service has been stopped working"}
106
+ {"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":5,"message":"An unknown error occured during authentication. user name: Tom"}
107
+ ```
108
+ - json config file sample
109
+ ```json
110
+ {
111
+ "RTALogger":
112
+ {
113
+ "Default_Manager": "Develop",
114
+ "Log_Managers":
115
+ [
116
+ {
117
+ "Manager_Name": "Develop",
118
+ "Enable": true,
119
+ "App_Name": "TestApp",
120
+ "Log_Severity": 2,
121
+ "Buffer_Size": 100,
122
+ "Flush_Wait_Seconds": 15,
123
+ "Formatter" : "JSON",
124
+ "Repos":
125
+ [
126
+ {
127
+ "Enable": true,
128
+ "Type": "Console"
129
+ },
130
+ {
131
+ "Enable": true,
132
+ "Type": "UDP",
133
+ "Host": "localhost",
134
+ "Port": 8888
135
+ },
136
+ {
137
+ "Enable": false,
138
+ "Type": "File",
139
+ "File_Path": "../../log/log.txt",
140
+ "Roll_Period": "daily",
141
+ "Roll_Size": "1048576"
142
+ },
143
+ {
144
+ "Enable": true,
145
+ "Type": "Fluentd",
146
+ "Host": "localhost",
147
+ "Port": "24442",
148
+ "TLS_Options":
149
+ {
150
+ "ca":",/path/to/cacert.pem",
151
+ "cert":"/path/to/client-cert.pem",
152
+ "key":"/path/to/client-key.pem",
153
+ "key_passphrase":"test"
154
+ }
155
+ }
156
+ ]
157
+ }
158
+ ]
159
+ }
160
+ }
161
+ ```
162
+ - json config file structure
163
+ ```comment
164
+ As we described you cap apply RTA log manager using a json config file.
165
+
166
+ log_manager.config_use_json_file('rta_logger_config.json')
167
+
168
+ The file structure:
169
+ - RTALogger : the root element of RTALogger json configuration.
170
+ - Default_Manager: the name of default log manager config, when there is
171
+ multiple log manager configuration in Log_Managers array.
172
+ - Log_Managers : the array of LogManagers with different configuration.
173
+ It is possible to define multiple log manager configurations for differen usages.
174
+ - Name: the name of log manager. It will be used to define the default log manager.
175
+ - Enable: (true/false) The value of this property activate or deactivate entire log manager.
176
+ - App_Name: Application name as the owner of log data.
177
+ - Log_Severity: Defines which level of log data will be stored in log repositories.
178
+ - BufferSize: The memory buffer size (number of buffered log objects) to
179
+ decread api consumers wait time. when the buffer is full the flush operation will
180
+ save buffered logs to log repositoies.
181
+ - Flush_Wait_Seconds: Time in soconds which log managers wait to flush buffered log objects
182
+ to log repository.
183
+ - Formatter: (JSON/TEXT) declare log format when it's required to converrt log object to text.
184
+ - Repos: Array of log repositories. It is possible to define multiple log repositories to
185
+ store log data. there are variaty of log repositories and it is possible to
186
+ add new ones. Each item in Repos array will configure a log repository.
187
+ - Log repository types and config:
188
+ 1- Console: Show log data in text format on standard out put
189
+ - "Type":"Console"
190
+ - "Enable": [true/false] this will activate or deactivate log repository.
191
+ 2- File: Store log data in a file.
192
+ - "Type":"Console"
193
+ - "Enable": [true/false] this will activate or deactivate log repository.
194
+ - "File_Path": [file path and file name] the path and the name to store log data.
195
+ - "Roll_Period": ["daily"/"weekly"/"monthly"] the period to generate new log file.
196
+ - "Roll_Size": [bytes] the maximum size of log file to
197
+ roll file and create the new log file
198
+ 3- UDP: Send log data over UDP on network.
199
+ - "Type":"Console"
200
+ - "Enable": [true/false] this will activate or deactivate log repository.
201
+ - "Host": IP of the server to send log data.
202
+ - "Port": Port of server to send log data.
203
+ 4- Fluentd: send log data to Fluentd Log collector over network using TCP/IP protocol.
204
+ - "Type":"Console"
205
+ - "Enable": [true/false] this will activate or deactivate log repository.
206
+ - "Host": IP of the server to send log data.
207
+ - "Port": Port of server to send log data.
208
+ - "TLS_Options": TLS configuration to stablish a secure TCP connection to Fluentd Server.
209
+
210
+ ```
211
+ - Some useful features
212
+ ```ruby
213
+ # change log manager app name at run time
214
+ log_manager.app_name = 'myTestApp'
37
215
 
38
- # load log manager configuration from a json config file
39
- log_manager.config_use_json_file('rta_logger_config.json')
216
+ # update specific topic log level if necessary
217
+ log_manager.update_topic_level(controller_name, RTALogger::LogSeverity::INFO)
40
218
 
41
- # add log repository to log manager
42
- #log_manager.propagator.add_log_repository(RTALogger::LogFactory.new_log_repository_console)
219
+ # update all topics log level if necessary
220
+ log_manager.update_all_topics_log_level(RTALogger::LogSeverity::INFO)
221
+ ```
222
+ - Implement and Expand
223
+ It is possible to implement new log repositories.
224
+ All repository classes should inherit from 'RTALogger::LogRepository'
225
+ Here is 'LogRepositoryConsole' implementation:
226
+ ```ruby
227
+ require_relative 'log_repository'
228
+ require_relative 'log_factory_log_formatter'
43
229
 
44
- # add new topic to log manager
45
- # use this api to get a new log topic instance
46
- # this api could be called in entry point of each service or class initialize method
47
- topic = log_manager.add_topic(controller_name)
230
+ module RTALogger
231
+ # show log items on console out put
232
+ class LogRepositoryConsole < LogRepository
233
+ def initialize
234
+ super
48
235
 
49
- # add log information to log topic
50
- topic.debug(userID, 'Controller Name=', controller_name, 'debug')
51
- topic.info(userID, 'Controller Name=', controller_name, 'information')
52
- topic.warning(userID, 'Controller Name=', controller_name, 'warning')
53
- topic.error(userID, 'Controller Name=', controller_name, 'error')
54
- topic.fatal(userID, 'Controller Name=', controller_name, 'fatal')
55
- topic.unknown(userID, 'Controller Name=', controller_name, 'unknown')
236
+ @formatter = RTALogger::LogFactory.log_formatter_default
237
+ end
56
238
 
57
- # update specific topic log level if necessary
58
- # log_manager.update_topic_level(controller_name, RTALogger::LogSeverity::INFO)
239
+ protected
59
240
 
60
- # update all topics log level if necessary
61
- # log_manager.update_all_topics_log_level(RTALogger::LogSeverity::INFO)
241
+ def flush_and_clear
242
+ semaphore.synchronize do
243
+ @log_records.each { |log_record| puts @formatter.format(log_record) }
244
+ end
245
+ super
246
+ end
247
+ end
248
+ end
249
+ ```
62
250
 
63
251
  ## Development
64
252
 
@@ -68,7 +256,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
68
256
 
69
257
  ## Contributing
70
258
 
71
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/RTALogger.
259
+ Bug reports and pull requests are welcome on GitHub at https://github.com/BBahrainy/RTALogger.
72
260
 
73
261
 
74
262
  ## License
@@ -27,6 +27,6 @@ Gem::Specification.new do |spec|
27
27
  spec.bindir = "exe"
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ["lib"]
30
- spec.add_dependency "fluentd", "~> 1.11", ">= 1.11.4"
30
+ spec.add_dependency "fluent-logger", "~> 0.9"
31
31
  spec.add_dependency "jbuilder", "~> 2.10"
32
32
  end
@@ -1,3 +1,3 @@
1
1
  module RTALogger
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
@@ -8,5 +8,13 @@ module RTALogger
8
8
  RTALogger::LogFormatterJSON.new
9
9
  # RTALogger::LogFormatterText.new
10
10
  end
11
+
12
+ def self.log_formatter_json
13
+ RTALogger::LogFormatterJSON.new
14
+ end
15
+
16
+ def self.log_formatter_text
17
+ RTALogger::LogFormatterText.new
18
+ end
11
19
  end
12
20
  end
@@ -3,6 +3,7 @@
3
3
  require_relative 'log_repository_console'
4
4
  require_relative 'log_repository_file'
5
5
  require_relative 'log_repository_udp'
6
+ require_relative 'log_repository_fluent'
6
7
 
7
8
  module RTALogger
8
9
  # this module generates object instance
@@ -32,11 +33,23 @@ module RTALogger
32
33
  ::RTALogger::LogFactory.new_log_repository_udp(host, port)
33
34
  end
34
35
 
36
+ def self.new_log_repository_fluent(host = 'localhost', port = '24224', tls_options = nil)
37
+ LogRepositoryFluent.new(host, port, tls_options)
38
+ end
39
+
40
+ def self.load_log_repository_fluent(config_json)
41
+ host = config_json['Host'].to_s
42
+ port = config_json['Port'].to_s
43
+ tls_options = config_json['TLS_Options']
44
+ ::RTALogger::LogFactory.new_log_repository_fluent(host, port, tls_options)
45
+ end
46
+
35
47
  def self.create_repository(type, config_json)
36
48
  result = nil
37
49
  result = new_log_repository_console if type.to_s.casecmp('Console').zero?
38
50
  result = load_log_repository_file(config_json) if type.to_s.casecmp('File').zero?
39
51
  result = load_log_repository_udp(config_json) if type.to_s.casecmp('UDP').zero?
52
+ result = load_log_repository_fluent(config_json) if type.to_s.casecmp('Fluentd').zero?
40
53
  result
41
54
  end
42
55
  end
@@ -0,0 +1,32 @@
1
+ require 'fluent-logger'
2
+ require_relative 'log_repository'
3
+
4
+ module RTALogger
5
+ class LogRepositoryFluent < LogRepository
6
+ def initialize(host = 'localhost', port = 24224, tls_options = nil)
7
+ super()
8
+ @host = host
9
+ @port = port
10
+ @tls_options = tls_options
11
+ @formatter = RTALogger::LogFactory.log_formatter_json
12
+ if @tls_options
13
+ @fluent_logger = ::Fluent::Logger::FluentLogger.new(nil, :host => @host, :port => @port, :use_nonblock => true, :wait_writeable => false)
14
+ else
15
+ @fluent_logger = ::Fluent::Logger::FluentLogger.new(nil, :host => @host, :port => @port, :tls_options => @tls_options, :use_nonblock => true, :wait_writeable => false)
16
+ end
17
+ end
18
+
19
+ def flush_and_clear
20
+ semaphore.synchronize do
21
+ @log_records.each do |log_record|
22
+ fluent_tag = log_record.app_name + '.' + log_record.topic_title
23
+ log_json_string = @formatter.format(log_record)
24
+ log_json = JSON.parse(log_json_string)
25
+
26
+ @fluent_logger.post(fluent_tag, log_json)
27
+ end
28
+ end
29
+ super
30
+ end
31
+ end
32
+ end
@@ -24,6 +24,12 @@
24
24
  "File_Path": "../../log/log.txt",
25
25
  "Roll_Period": "daily",
26
26
  "Roll_Size": "1048576"
27
+ },
28
+ {
29
+ "Enable": true,
30
+ "Type": "Fluentd",
31
+ "Host": "localhost",
32
+ "Port": "8888"
27
33
  }
28
34
  ]
29
35
  }
metadata CHANGED
@@ -1,35 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RTALogger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Babak Bahreini, RTA Backend Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-04 00:00:00.000000000 Z
11
+ date: 2020-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: fluentd
14
+ name: fluent-logger
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.11'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 1.11.4
19
+ version: '0.9'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '1.11'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 1.11.4
26
+ version: '0.9'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: jbuilder
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -90,6 +84,7 @@ files:
90
84
  - lib/log_repository.rb
91
85
  - lib/log_repository_console.rb
92
86
  - lib/log_repository_file.rb
87
+ - lib/log_repository_fluent.rb
93
88
  - lib/log_repository_udp.rb
94
89
  - lib/log_severity.rb
95
90
  - lib/log_topic.rb