RTALogger 0.1.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +246 -109
- data/lib/RTALogger/version.rb +1 -1
- data/lib/log_factory_log_formatter.rb +24 -8
- data/lib/log_factory_repository.rb +23 -42
- data/lib/log_factory_topic.rb +2 -2
- data/lib/log_formatter_base.rb +33 -0
- data/lib/log_formatter_json.rb +6 -3
- data/lib/log_formatter_text.rb +11 -8
- data/lib/log_manager.rb +155 -50
- data/lib/log_propagator.rb +41 -15
- data/lib/log_record.rb +1 -1
- data/lib/log_repository.rb +50 -1
- data/lib/log_repository_console.rb +5 -1
- data/lib/log_repository_file.rb +33 -3
- data/lib/log_repository_fluentd.rb +58 -0
- data/lib/log_repository_udp.rb +14 -6
- data/lib/log_topic.rb +35 -14
- data/lib/rta_logger_config.json +46 -22
- data/lib/sample.rb +13 -2
- data/lib/severity_level.rb +68 -0
- data/lib/string.rb +9 -0
- metadata +6 -6
- data/lib/log_factory_file_logger.rb +0 -17
- data/lib/log_formatter.rb +0 -8
- data/lib/log_repository_fluent.rb +0 -32
- data/lib/log_severity.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09e2fc76df63cc28bd810dd7632c40e1fb7401a98ac21f3f9b837139a9a0c7a5'
|
4
|
+
data.tar.gz: 267c71efd35367fa4e70cdff396d7f9d0e9443c78963368db19b06da1cd61f07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dfec223a98f1ccdaaf7c569179630698cb94d67d1554a403d5e06833dcbf90677fd1dee37aeec0c732afa9c23e931abee54cf2335f1f78b910b35593b42e1d3
|
7
|
+
data.tar.gz: 602f91b5eb2ef9b764a963727c9177e6e5ff62d8ff21d52745816b00bdd13173bdbfe40f33e3eca7374f50ca3b7e6f84809a4efbc4af70ec0247de6b2cf78b1d
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -7,26 +7,24 @@ All log manager's main features are configable through a json config file.
|
|
7
7
|
|
8
8
|
Main purposes of developing this gem are:
|
9
9
|
- Creating standard logging API to seperate application from existing variety of loggers.
|
10
|
-
- Wrapping around existing loggers
|
11
|
-
- Make it possible to easily replace a logger component with
|
12
|
-
|
13
|
-
-
|
14
|
-
-
|
15
|
-
- No interrupt or wait time for log consumer modules.
|
10
|
+
- Wrapping around existing loggers to get advantage of different loggers at the same time.
|
11
|
+
- Make it possible to easily replace a logger component with new one without any changes in the consumer application.(for example Rails standard Logger with Fluentd)
|
12
|
+
- Creating easy to use logger interface for developers.
|
13
|
+
- Apply some rules and restrictions about log structure and data format, which prevents chaos in application's log information.
|
14
|
+
- No interrupt, wait time or overhead for log consumer modules.
|
16
15
|
- Utilize multiple log repositories at the same time in background (Console, File, UDP, FluentD, etc.)
|
17
|
-
- Make it possible to implement
|
16
|
+
- Make it possible to implement customize log repositories.
|
18
17
|
|
19
18
|
Main Features:
|
20
19
|
- Creating multiple log manager instances with different configuration is possible entire application.
|
21
20
|
- Each log manager instance could be configured via a json file.
|
22
21
|
- Each log manager instance could be config to use multiple log repositories such as Console, File, UDP, Fluentd.
|
23
22
|
- Runtime configurations could be applied through log manager APIs.
|
24
|
-
- By using multi threading
|
25
|
-
all logging process will handled in seperated thread.
|
23
|
+
- By using multi threading and buffering techniques, all logging process will handled in seperated thread.
|
26
24
|
So the log consumer modules should not be wait for log manager to finish the logging task.
|
27
25
|
- Multiple standard log severity levels are available through topic APIs (debug, info, warning, error, fatal, unknown)
|
28
26
|
- Main features could be set and manipulate through json configuration file.
|
29
|
-
- And at the end, it is easy to use for ruby
|
27
|
+
- And at the end, it is easy to use for ruby developers.
|
30
28
|
|
31
29
|
## Installation
|
32
30
|
|
@@ -36,11 +34,11 @@ Add this line to your application's Gemfile:
|
|
36
34
|
gem 'RTALogger'
|
37
35
|
```
|
38
36
|
|
39
|
-
|
37
|
+
Then execute:
|
40
38
|
|
41
39
|
$ bundle install
|
42
40
|
|
43
|
-
Or install it yourself
|
41
|
+
Or install it yourself via following command:
|
44
42
|
|
45
43
|
$ gem install RTALogger
|
46
44
|
|
@@ -51,21 +49,22 @@ To add gem to your rails application:
|
|
51
49
|
## Usage
|
52
50
|
#### RTA Log Data Structure
|
53
51
|
To use log manager APIs, first step is to have a quick review on Log Data Structure
|
54
|
-
- Application: The root of each log data record is Application, which specify the log data owner application.
|
52
|
+
- Application: The root of each log data record is the Application name, which specify the log data owner application.
|
55
53
|
- Topic: By adding multiple topics to log manager you can categorize log data in logical topics.
|
56
54
|
- Context: Under each topic, one or multiple contexts (in one level) could be defined.
|
57
|
-
- As an instance
|
58
|
-
|
59
|
-
- The next step is log severity level, which determines
|
55
|
+
- As an instance for Application 'MyEShopApp', one of Topics could be 'Authentication' and
|
56
|
+
Context could be 'uer_name' which attend in application authorization process.
|
57
|
+
- The next step is log severity level, which determines the log record severity (debug, information, warning, error, fatal, unknown)
|
60
58
|
- At last the final element is log message, which contains log message data.
|
61
59
|
|
62
60
|
### Which Log Severity Levels to use
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
66
|
-
-
|
67
|
-
-
|
68
|
-
-
|
61
|
+
- TRACE = 0 : all information that helps us to trace the processing of an incoming request through our application.
|
62
|
+
- DEBUG = 1 : Low-level information, mostly for developers.
|
63
|
+
- INFO = 2 : Generic (useful) information about system operation.
|
64
|
+
- WARN = 3 : A warning, which it does NOT cause crashing the process.
|
65
|
+
- ERROR = 4 : A handleable error condition.
|
66
|
+
- FATAL = 5 : An un-handleable error that results in a program crash.
|
67
|
+
- UNKNOWN = 6 : An unknown message that should always be logged.
|
69
68
|
|
70
69
|
### Time for coding
|
71
70
|
- create log manager instance:
|
@@ -81,6 +80,71 @@ To use log manager APIs, first step is to have a quick review on Log Data Struct
|
|
81
80
|
# the parameter is the json config file
|
82
81
|
log_manager.config_use_json_file('rta_logger_config.json')
|
83
82
|
```
|
83
|
+
- Sample configuration json file
|
84
|
+
```
|
85
|
+
{
|
86
|
+
"rta_logger":
|
87
|
+
{
|
88
|
+
"default_manager": "develop",
|
89
|
+
"log_managers":
|
90
|
+
[
|
91
|
+
{
|
92
|
+
"title": "develop",
|
93
|
+
"enable": true,
|
94
|
+
"app_name": "TestApp",
|
95
|
+
"severity_level": "trace",
|
96
|
+
"buffer_size": 100,
|
97
|
+
"flush_wait_seconds": 10,
|
98
|
+
"repositories":
|
99
|
+
[
|
100
|
+
{
|
101
|
+
"type": "console",
|
102
|
+
"title": "console_repo_1",
|
103
|
+
"enable": true,
|
104
|
+
"formatter":
|
105
|
+
{
|
106
|
+
"type": "text",
|
107
|
+
"delimiter": "|"
|
108
|
+
}
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"type": "file",
|
112
|
+
"title": "file_repo_1",
|
113
|
+
"enable": true,
|
114
|
+
"file_path": "log.txt",
|
115
|
+
"roll_period": "daily",
|
116
|
+
"roll_size": "1048576",
|
117
|
+
"formatter":
|
118
|
+
{
|
119
|
+
"type": "json",
|
120
|
+
"delimiter": "|"
|
121
|
+
}
|
122
|
+
},
|
123
|
+
{
|
124
|
+
"enable": true,
|
125
|
+
"title": "console_repo_1",
|
126
|
+
"type": "fluentd",
|
127
|
+
"host": "localhost",
|
128
|
+
"port": "8888",
|
129
|
+
"formatter":
|
130
|
+
{
|
131
|
+
"type": "json"
|
132
|
+
}
|
133
|
+
}
|
134
|
+
],
|
135
|
+
"topics":
|
136
|
+
[
|
137
|
+
{
|
138
|
+
"title": "test",
|
139
|
+
"enable": true,
|
140
|
+
"severity_level": "WARN"
|
141
|
+
}
|
142
|
+
]
|
143
|
+
}
|
144
|
+
]
|
145
|
+
}
|
146
|
+
}
|
147
|
+
```
|
84
148
|
- Add new topic to log manager and get the topic instance
|
85
149
|
```ruby
|
86
150
|
# the parameter is the topic name
|
@@ -93,69 +157,84 @@ To use log manager APIs, first step is to have a quick review on Log Data Struct
|
|
93
157
|
# Assume user 'Tom' is trying to authenticate we will use user_name as log Context_id
|
94
158
|
user_name = 'Tom'
|
95
159
|
topic = log_manager.add_topic('Authentication')
|
160
|
+
topic.trace(user_name, 'Authentication process began for:', user_name)
|
96
161
|
topic.debug(user_name, 'use_id is nil for user:', user_name)
|
97
162
|
topic.info(user_name, 'User ', user_name , ' is trying to login.')
|
98
163
|
topic.warning(user_name, 'Authentication failed for user ', user_name)
|
99
164
|
topic.error(user_name, 'Error connecting to data base for user ', user_name)
|
100
165
|
topic.fatal(user_name, 'Authentication service has been stopped working')
|
101
166
|
topic.unknown(user_name, 'An unknown error occured during authentication. user name:', user_name)
|
167
|
+
topic.trace(user_name, 'Authentication process end for:', user_name)
|
102
168
|
```
|
103
169
|
the result will be:
|
104
170
|
```
|
105
|
-
{"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":
|
106
|
-
{"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":
|
107
|
-
{"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":
|
108
|
-
{"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":
|
109
|
-
{"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":
|
110
|
-
{"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":
|
171
|
+
{"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":"TRACE","message"Authentication process began for: Tom"}
|
172
|
+
{"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":"DEBUG","message":"user_id is nil for user: Tom"}
|
173
|
+
{"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":"INFO","message":"User Tom is trying to login"}
|
174
|
+
{"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":"WARN","message":"Authentication failed for user Tom"}
|
175
|
+
{"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":"ERROR","message":"Error connecting to data base for user Tom"}
|
176
|
+
{"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":"FATAL","message":"Authentication service has been stopped working"}
|
177
|
+
{"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":"UNKNOWN","message":"An unknown error occured during authentication. user name: Tom"}
|
178
|
+
{"occurred_at":"2020-11-04 15:56:58:785","app_name":"TestApp","topic_title":"Authentication","context_id":"Tom","severity":"TRACE","message"Authentication process end for: Tom"}
|
111
179
|
```
|
112
180
|
- json config file sample
|
113
181
|
```json
|
114
182
|
{
|
115
|
-
"
|
183
|
+
"rta_logger":
|
116
184
|
{
|
117
|
-
"
|
118
|
-
"
|
185
|
+
"default_manager": "develop",
|
186
|
+
"log_managers":
|
119
187
|
[
|
120
188
|
{
|
121
|
-
"
|
122
|
-
"
|
123
|
-
"
|
124
|
-
"
|
125
|
-
"
|
126
|
-
"
|
127
|
-
"
|
128
|
-
"Repos":
|
189
|
+
"title": "develop",
|
190
|
+
"enable": true,
|
191
|
+
"app_name": "TestApp",
|
192
|
+
"severity_level": "trace",
|
193
|
+
"buffer_size": 100,
|
194
|
+
"flush_wait_seconds": 10,
|
195
|
+
"repositories":
|
129
196
|
[
|
130
197
|
{
|
131
|
-
"
|
132
|
-
"
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
198
|
+
"type": "console",
|
199
|
+
"title": "console_repo_1",
|
200
|
+
"enable": true,
|
201
|
+
"formatter":
|
202
|
+
{
|
203
|
+
"type": "text",
|
204
|
+
"delimiter": "|"
|
205
|
+
}
|
139
206
|
},
|
140
207
|
{
|
141
|
-
"
|
142
|
-
"
|
143
|
-
"
|
144
|
-
"
|
145
|
-
"
|
208
|
+
"type": "file",
|
209
|
+
"title": "file_repo_1",
|
210
|
+
"enable": true,
|
211
|
+
"file_path": "log.txt",
|
212
|
+
"roll_period": "daily",
|
213
|
+
"roll_size": "1048576",
|
214
|
+
"formatter":
|
215
|
+
{
|
216
|
+
"type": "json",
|
217
|
+
"delimiter": "|"
|
218
|
+
}
|
146
219
|
},
|
147
220
|
{
|
148
|
-
"
|
149
|
-
"
|
150
|
-
"
|
151
|
-
"
|
152
|
-
"
|
221
|
+
"enable": true,
|
222
|
+
"title": "console_repo_1",
|
223
|
+
"type": "fluentd",
|
224
|
+
"host": "localhost",
|
225
|
+
"port": "8888",
|
226
|
+
"formatter":
|
153
227
|
{
|
154
|
-
"
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
228
|
+
"type": "json"
|
229
|
+
}
|
230
|
+
}
|
231
|
+
],
|
232
|
+
"topics":
|
233
|
+
[
|
234
|
+
{
|
235
|
+
"title": "test",
|
236
|
+
"enable": true,
|
237
|
+
"severity_level": "WARN"
|
159
238
|
}
|
160
239
|
]
|
161
240
|
}
|
@@ -163,69 +242,134 @@ the result will be:
|
|
163
242
|
}
|
164
243
|
}
|
165
244
|
```
|
166
|
-
|
245
|
+
### json config file structure
|
167
246
|
```comment
|
168
247
|
As we described you cap apply RTA log manager using a json config file.
|
169
248
|
|
170
249
|
log_manager.config_use_json_file('rta_logger_config.json')
|
171
250
|
|
172
251
|
The file structure:
|
173
|
-
-
|
174
|
-
-
|
252
|
+
- rta_logger : the root element of rta_logger json configuration.
|
253
|
+
- default_manager: the name of default log manager config, when there is
|
175
254
|
multiple log manager configuration in Log_Managers array.
|
176
|
-
-
|
255
|
+
- log_managers : the array of LogManagers with different configuration.
|
177
256
|
It is possible to define multiple log manager configurations for differen usages.
|
178
|
-
-
|
179
|
-
-
|
180
|
-
-
|
181
|
-
-
|
182
|
-
-
|
257
|
+
- title: the name of log manager. It will be used to define the default log manager.
|
258
|
+
- enable: (true/false) The value of this property activate or deactivate entire log manager.
|
259
|
+
- app_name: Application name as the owner of log data.
|
260
|
+
- severity_level: Defines which level of log data will be stored in log repositories.
|
261
|
+
- buffer_size: Minimune possible value for this attribute is 100 and defines memory buffer size (number of buffered log objects) to
|
183
262
|
decread api consumers wait time. when the buffer is full the flush operation will
|
184
263
|
save buffered logs to log repositoies.
|
185
|
-
-
|
264
|
+
- flush_wait_seconds: Minimum possible value for this attribure is 10 seconds and defines time in soconds which log managers wait to flush buffered log records
|
186
265
|
to log repository.
|
187
|
-
-
|
188
|
-
- Repos: Array of log repositories. It is possible to define multiple log repositories to
|
266
|
+
- repositories: Array of log repositories. It is possible to define multiple log repositories to
|
189
267
|
store log data. there are variaty of log repositories and it is possible to
|
190
268
|
add new ones. Each item in Repos array will configure a log repository.
|
269
|
+
Pre-defined types are described below, also it's possible to implement your custome repo type
|
270
|
+
and register it to RTALogger.
|
191
271
|
- Log repository types and config:
|
192
|
-
1-
|
193
|
-
- "
|
194
|
-
- "
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
- "
|
272
|
+
1- console: Show log data in text format on standard out put
|
273
|
+
- "type": "console"
|
274
|
+
- "enable": [true/false] this will activate or deactivate log repository.
|
275
|
+
- "foramtter" is the text, json or any custome defined types as LogRecord formatter
|
276
|
+
- "type": ["text"/"json"] type of formatter
|
277
|
+
- "delimiter": [any text delimiter you need.(as an instance pipe line "|")]
|
278
|
+
if formatter not defined then the json formatter will be used
|
279
|
+
2- file: Store log data in a file.
|
280
|
+
- "type": "console"
|
281
|
+
- "enable": [true/false] this will activate or deactivate log repository.
|
282
|
+
- "file_path": [file path and file name] the path and the name to store log data.
|
283
|
+
- "roll_period": ["daily"/"weekly"/"monthly"] the period to generate new log file.
|
284
|
+
- "roll_size": [bytes] the maximum size of log file to
|
201
285
|
roll file and create the new log file
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
- "
|
209
|
-
- "
|
210
|
-
- "
|
211
|
-
|
212
|
-
- "
|
213
|
-
|
286
|
+
- "foramtter" is the text, json or any custome defined types as LogRecord formatter
|
287
|
+
- "type": ["text"/"json"] type of formatter
|
288
|
+
- "delimiter": [any text delimiter you need.(as an instance pipe line "|")]
|
289
|
+
if formatter not defined then the json formatter will be used
|
290
|
+
3- udp: Send log data over UDP on network.
|
291
|
+
- "type": "udp"
|
292
|
+
- "enable": [true/false] this will activate or deactivate log repository.
|
293
|
+
- "host": IP of the server to send log data.
|
294
|
+
- "port": Port of server to send log data.
|
295
|
+
4- fluentd: send log data to Fluentd Log collector over network using TCP/IP protocol.
|
296
|
+
- "type": "fluentd"
|
297
|
+
- "enable": [true/false] this will activate or deactivate log repository.
|
298
|
+
- "host": IP of the server to send log data.
|
299
|
+
- "port": Port of server to send log data.
|
300
|
+
- "tls_options": TLS configuration to stablish a secure TCP connection to Fluentd Server.
|
301
|
+
- "foramtter" is the text, json or any custome defined types as LogRecord formatter
|
302
|
+
- "type": ["text"/"json"] type of formatter
|
303
|
+
- "delimiter": [any text delimiter you need.(as an instance pipe line "|")]
|
304
|
+
if formatter not defined then the json formatter will be used
|
305
|
+
- topics: This is an optional item. When you need to customize a specific topic severity level or
|
306
|
+
enable value, you can define the settings here.
|
307
|
+
- title: The topic title to customize. (mandatoy).
|
308
|
+
- severity_level: Defines which level of log data will be stored in log repositories.
|
309
|
+
- enable: [true/false] to enable or disable logging process of the topic.
|
214
310
|
```
|
215
|
-
|
311
|
+
###Some useful features
|
216
312
|
```ruby
|
217
313
|
# change log manager app name at run time
|
218
314
|
log_manager.app_name = 'myTestApp'
|
219
315
|
|
220
316
|
# update specific topic log level if necessary
|
221
|
-
log_manager.
|
317
|
+
log_manager.update_topic_severity_level(topic_title, RTALogger::SeverityLevel::INFO)
|
318
|
+
|
319
|
+
# update all topics severity level if necessary
|
320
|
+
log_manager.update_all_topics_severity_level(RTALogger::SeverityLevel::INFO)
|
321
|
+
|
322
|
+
# enable or disable specific topic if necessary
|
323
|
+
log_manager.update_topic_enable(topic_title, [true/false])
|
324
|
+
|
325
|
+
# enable or disable all topic if necessary
|
326
|
+
log_manager.update_all_topics_enable([true/false])
|
222
327
|
|
223
|
-
#
|
224
|
-
log_manager.
|
328
|
+
# to get log manager configuration as json object use to_builder method
|
329
|
+
log_manager.to_builder
|
330
|
+
|
331
|
+
# to get log manager configuration as json string use reveal_config method
|
332
|
+
log_manager.reveal_config
|
333
|
+
|
334
|
+
# to apply some limited changes on log manager functionality at run time
|
335
|
+
# config_json parameter should carry a json object which contains the configuration
|
336
|
+
# structure described before in 'json configuration file structure' section.
|
337
|
+
# Attention: these changes will apply to manager but will not save.
|
338
|
+
# So during next load these changes will be lost. Save changes will be available in
|
339
|
+
# next version.
|
340
|
+
# Attention: only following attributes could be change at run time:
|
341
|
+
# log_manager.enable
|
342
|
+
# log_manager.default_severity_level
|
343
|
+
# log_manager.buffer_size (minimum is 100)
|
344
|
+
# log_manager.flush_wait_time (minimum 15 second)
|
345
|
+
# repository.enable
|
346
|
+
# topic.enable
|
347
|
+
# topic.severity_level
|
348
|
+
# Other attributes could only change via config file via manager config_use_json_file
|
349
|
+
log_manager.apply_run_time_config(config_json)
|
225
350
|
```
|
226
|
-
|
227
|
-
|
228
|
-
|
351
|
+
### Implement and Expand
|
352
|
+
#### Implement new log repository
|
353
|
+
It is possible to implement new log repositories. There will be fue rules to implement and
|
354
|
+
integrate new customized log repository with RTALogger LogManager.
|
355
|
+
|
356
|
+
1- Define you class inside RTALogger module.
|
357
|
+
|
358
|
+
2- The class should be inherited from 'RTALogger::LogRepository'.
|
359
|
+
|
360
|
+
3- Also appropriate naming convention is necessary.
|
361
|
+
As an example if you are implementing a Console Repo, your class name should be LogRepositoryConsole and
|
362
|
+
your source code should be placed in a ruby file and name it log_repository_console.rb
|
363
|
+
|
364
|
+
4- After implementing your own log repository, you should register the class at run-time using the following syntax:
|
365
|
+
```ruby
|
366
|
+
RTALogger::LogFactory.register_log_repository :console, 'log_repository_console.rb'
|
367
|
+
```
|
368
|
+
Another example: LogRepositoryMyCustomizedUdp
|
369
|
+
|
370
|
+
```ruby
|
371
|
+
RTALogger::LogFactory.register_log_repository :my_customized_udp, 'log_repository_my_customized_udp.rb'
|
372
|
+
```
|
229
373
|
Here is 'LogRepositoryConsole' implementation:
|
230
374
|
```ruby
|
231
375
|
require_relative 'log_repository'
|
@@ -252,17 +396,10 @@ module RTALogger
|
|
252
396
|
end
|
253
397
|
```
|
254
398
|
|
255
|
-
## Development
|
256
|
-
|
257
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
258
|
-
|
259
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
260
|
-
|
261
399
|
## Contributing
|
262
400
|
|
263
401
|
Bug reports and pull requests are welcome on GitHub at https://github.com/BBahrainy/RTALogger.
|
264
402
|
|
265
|
-
|
266
403
|
## License
|
267
404
|
|
268
405
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|