ext_logger 0.1.3 → 0.2.0

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
  SHA1:
3
- metadata.gz: df06e36f53ca03d322ec99860e7fc8c28366213e
4
- data.tar.gz: e256e87a1936a8e330d9c30a26baad0c97194c44
3
+ metadata.gz: 6fb8e5a361934db3221aaa2d96c0b04dfd2ef30b
4
+ data.tar.gz: e628741ec577cdefd2226ea9c6af4721dc308921
5
5
  SHA512:
6
- metadata.gz: f3a6723867094d159543125184ca76b9bb4708c5f143a84d3b9404bdaacf6bea937272f4d5bdc6d2cf5294283beb325cc86940b771d78681adcf0b0d732d0c06
7
- data.tar.gz: 6a98fa8acdc5a74ab879e9a7c8d8dfc6cfa7946150ce5b1af8e7cd45807c8c153a5a3de382bc179ed54ac4e54645bf92cb129002468fddec4a1e1f7c3b1a8423
6
+ metadata.gz: ac616c82566339f401c2a742748f632ee5e5c2ad9fb5bc387d14cf1dfb83b13dff127870de78213ba3dc93ddf6f6fac9863a8490f1c3e5c93a6aead9f0ed5386
7
+ data.tar.gz: efb96a84b8a873d1cebfd3bee698f821c6038f5a8e654e1d4ebb84a4d11c07eb239975a5d9ae3bdf62ea1ddabc7a465004e7d083234b779fc0449c52a79f92bf
data/.idea/workspace.xml CHANGED
@@ -4,6 +4,7 @@
4
4
  <list default="true" id="09d7e2e9-1cd6-481d-b2bb-16f8f2694524" name="Default" comment="">
5
5
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/ext_logger.iml" afterPath="$PROJECT_DIR$/.idea/ext_logger.iml" />
6
6
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
7
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/README.md" afterPath="$PROJECT_DIR$/README.md" />
7
8
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/ext_logger.gemspec" afterPath="$PROJECT_DIR$/ext_logger.gemspec" />
8
9
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/ext_logger/logger.rb" afterPath="$PROJECT_DIR$/lib/ext_logger/logger.rb" />
9
10
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/ext_logger/version.rb" afterPath="$PROJECT_DIR$/lib/ext_logger/version.rb" />
@@ -21,8 +22,8 @@
21
22
  <entry file="file://$PROJECT_DIR$/README.md">
22
23
  <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
23
24
  <state split_layout="SPLIT">
24
- <first_editor relative-caret-position="75">
25
- <caret line="5" column="75" lean-forward="false" selection-start-line="5" selection-start-column="75" selection-end-line="5" selection-end-column="75" />
25
+ <first_editor relative-caret-position="435">
26
+ <caret line="29" column="95" lean-forward="false" selection-start-line="29" selection-start-column="95" selection-end-line="29" selection-end-column="95" />
26
27
  <folding />
27
28
  </first_editor>
28
29
  <second_editor />
@@ -30,11 +31,11 @@
30
31
  </provider>
31
32
  </entry>
32
33
  </file>
33
- <file leaf-file-name="ext_logger.gemspec" pinned="false" current-in-tab="true">
34
+ <file leaf-file-name="ext_logger.gemspec" pinned="false" current-in-tab="false">
34
35
  <entry file="file://$PROJECT_DIR$/ext_logger.gemspec">
35
36
  <provider selected="true" editor-type-id="text-editor">
36
37
  <state relative-caret-position="225">
37
- <caret line="15" column="68" lean-forward="true" selection-start-line="15" selection-start-column="68" selection-end-line="15" selection-end-column="68" />
38
+ <caret line="15" column="219" lean-forward="false" selection-start-line="15" selection-start-column="219" selection-end-line="15" selection-end-column="219" />
38
39
  <folding />
39
40
  </state>
40
41
  </provider>
@@ -43,8 +44,8 @@
43
44
  <file leaf-file-name="version.rb" pinned="false" current-in-tab="false">
44
45
  <entry file="file://$PROJECT_DIR$/lib/ext_logger/version.rb">
45
46
  <provider selected="true" editor-type-id="text-editor">
46
- <state relative-caret-position="30">
47
- <caret line="2" column="13" lean-forward="false" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="18" />
47
+ <state relative-caret-position="60">
48
+ <caret line="4" column="0" lean-forward="true" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
48
49
  <folding />
49
50
  </state>
50
51
  </provider>
@@ -60,11 +61,11 @@
60
61
  </provider>
61
62
  </entry>
62
63
  </file>
63
- <file leaf-file-name="logger.rb" pinned="false" current-in-tab="false">
64
+ <file leaf-file-name="logger.rb" pinned="false" current-in-tab="true">
64
65
  <entry file="file://$PROJECT_DIR$/lib/ext_logger/logger.rb">
65
66
  <provider selected="true" editor-type-id="text-editor">
66
- <state relative-caret-position="416">
67
- <caret line="56" column="47" lean-forward="false" selection-start-line="56" selection-start-column="47" selection-end-line="56" selection-end-column="47" />
67
+ <state relative-caret-position="278">
68
+ <caret line="228" column="28" lean-forward="true" selection-start-line="228" selection-start-column="28" selection-end-line="228" selection-end-column="28" />
68
69
  <folding />
69
70
  </state>
70
71
  </provider>
@@ -73,8 +74,8 @@
73
74
  <file leaf-file-name="logger.rb" pinned="false" current-in-tab="false">
74
75
  <entry file="file://$USER_HOME$/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/logger.rb">
75
76
  <provider selected="true" editor-type-id="text-editor">
76
- <state relative-caret-position="227">
77
- <caret line="631" column="11" lean-forward="false" selection-start-line="631" selection-start-column="4" selection-end-line="631" selection-end-column="11" />
77
+ <state relative-caret-position="2558">
78
+ <caret line="788" column="38" lean-forward="false" selection-start-line="788" selection-start-column="13" selection-end-line="788" selection-end-column="38" />
78
79
  <folding />
79
80
  </state>
80
81
  </provider>
@@ -86,7 +87,41 @@
86
87
  <findStrings>
87
88
  <find>def ini</find>
88
89
  <find>blank?</find>
90
+ <find>valid_rails</find>
91
+ <find>blank</find>
92
+ <find>@formatter</find>
93
+ <find>_file_postfix</find>
94
+ <find>path</find>
95
+ <find>args[0]</find>
96
+ <find>shift_age</find>
97
+ <find>root_path</find>
98
+ <find>ExtLogger.split_file</find>
99
+ <find>self.is_blank?</find>
100
+ <find>self.</find>
101
+ <find>split_postfix</find>
102
+ <find>@log_postfix_format</find>
103
+ <find>_postfix</find>
104
+ <find>puts</find>
105
+ <find>@output_flag</find>
106
+ <find>output?</find>
107
+ <find>DATE_FORMAT_MEMBER_LIST</find>
89
108
  </findStrings>
109
+ <replaceStrings>
110
+ <replace>now_time</replace>
111
+ <replace>_file_postfix</replace>
112
+ <replace>_path</replace>
113
+ <replace>path</replace>
114
+ <replace>_postfix</replace>
115
+ <replace>root_path</replace>
116
+ <replace>rails_root</replace>
117
+ <replace>split_file</replace>
118
+ <replace>is_blank?</replace>
119
+ <replace>split_format</replace>
120
+ <replace>@log_split_format</replace>
121
+ <replace>_split_format</replace>
122
+ <replace>pt</replace>
123
+ <replace>put_to_console</replace>
124
+ </replaceStrings>
90
125
  </component>
91
126
  <component name="Git.Settings">
92
127
  <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@@ -95,10 +130,10 @@
95
130
  <option name="CHANGED_PATHS">
96
131
  <list>
97
132
  <option value="$PROJECT_DIR$/.ruby-gemset" />
133
+ <option value="$PROJECT_DIR$/ext_logger.gemspec" />
134
+ <option value="$PROJECT_DIR$/lib/ext_logger/version.rb" />
98
135
  <option value="$PROJECT_DIR$/README.md" />
99
136
  <option value="$PROJECT_DIR$/lib/ext_logger/logger.rb" />
100
- <option value="$PROJECT_DIR$/lib/ext_logger/version.rb" />
101
- <option value="$PROJECT_DIR$/ext_logger.gemspec" />
102
137
  </list>
103
138
  </option>
104
139
  </component>
@@ -127,7 +162,6 @@
127
162
  <foldersAlwaysOnTop value="true" />
128
163
  </navigator>
129
164
  <panes>
130
- <pane id="Scratches" />
131
165
  <pane id="ProjectPane">
132
166
  <subPane>
133
167
  <expand>
@@ -156,10 +190,20 @@
156
190
  <item name="ext_logger" type="462c0819:PsiDirectoryNode" />
157
191
  <item name="pkg" type="462c0819:PsiDirectoryNode" />
158
192
  </path>
193
+ <path>
194
+ <item name="ext_logger" type="b2602c69:ProjectViewProjectNode" />
195
+ <item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
196
+ </path>
197
+ <path>
198
+ <item name="ext_logger" type="b2602c69:ProjectViewProjectNode" />
199
+ <item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
200
+ <item name="&lt; RVM: ruby-2.3.1 [gem_ext_logger] &gt;" type="70bed36:NamedLibraryElementNode" />
201
+ </path>
159
202
  </expand>
160
203
  <select />
161
204
  </subPane>
162
205
  </pane>
206
+ <pane id="Scratches" />
163
207
  <pane id="Scope" />
164
208
  </panes>
165
209
  </component>
@@ -202,12 +246,14 @@
202
246
  <updated>1543388051130</updated>
203
247
  <workItem from="1543388052866" duration="1829000" />
204
248
  <workItem from="1543393243729" duration="348000" />
205
- <workItem from="1543398726895" duration="1839000" />
249
+ <workItem from="1543398726895" duration="2281000" />
250
+ <workItem from="1543543683820" duration="89000" />
251
+ <workItem from="1544081694369" duration="15431000" />
206
252
  </task>
207
253
  <servers />
208
254
  </component>
209
255
  <component name="TimeTrackingManager">
210
- <option name="totallyTimeSpent" value="4016000" />
256
+ <option name="totallyTimeSpent" value="19978000" />
211
257
  </component>
212
258
  <component name="ToolWindowManager">
213
259
  <frame x="0" y="0" width="1280" height="800" extended-state="0" />
@@ -217,18 +263,18 @@
217
263
  <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
218
264
  <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
219
265
  <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
266
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
220
267
  <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
221
268
  <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
222
269
  <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
270
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
223
271
  <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
224
272
  <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
225
273
  <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
226
274
  <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
227
- <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
228
275
  <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
229
276
  <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
230
277
  <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
231
- <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
232
278
  </layout>
233
279
  </component>
234
280
  <component name="TypeScriptGeneratedFilesManager">
@@ -238,10 +284,114 @@
238
284
  <option name="myLimit" value="2678400000" />
239
285
  </component>
240
286
  <component name="XDebuggerManager">
241
- <breakpoint-manager />
287
+ <breakpoint-manager>
288
+ <option name="time" value="1" />
289
+ </breakpoint-manager>
242
290
  <watches-manager />
243
291
  </component>
244
292
  <component name="editorHistoryManager">
293
+ <entry file="file://$PROJECT_DIR$/README.md">
294
+ <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
295
+ <state split_layout="SPLIT">
296
+ <first_editor relative-caret-position="75">
297
+ <caret line="5" column="75" lean-forward="false" selection-start-line="5" selection-start-column="75" selection-end-line="5" selection-end-column="75" />
298
+ <folding />
299
+ </first_editor>
300
+ <second_editor />
301
+ </state>
302
+ </provider>
303
+ </entry>
304
+ <entry file="file://$PROJECT_DIR$/ext_logger.gemspec">
305
+ <provider selected="true" editor-type-id="text-editor">
306
+ <state relative-caret-position="300">
307
+ <caret line="20" column="31" lean-forward="false" selection-start-line="20" selection-start-column="31" selection-end-line="20" selection-end-column="31" />
308
+ <folding />
309
+ </state>
310
+ </provider>
311
+ </entry>
312
+ <entry file="file://$PROJECT_DIR$/lib/ext_logger/version.rb">
313
+ <provider selected="true" editor-type-id="text-editor">
314
+ <state relative-caret-position="30">
315
+ <caret line="2" column="13" lean-forward="false" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="18" />
316
+ <folding />
317
+ </state>
318
+ </provider>
319
+ </entry>
320
+ <entry file="file://$PROJECT_DIR$/Gemfile">
321
+ <provider selected="true" editor-type-id="text-editor">
322
+ <state relative-caret-position="0">
323
+ <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
324
+ <folding />
325
+ </state>
326
+ </provider>
327
+ </entry>
328
+ <entry file="file://$USER_HOME$/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/logger.rb">
329
+ <provider selected="true" editor-type-id="text-editor">
330
+ <state relative-caret-position="9465">
331
+ <caret line="631" column="11" lean-forward="false" selection-start-line="631" selection-start-column="4" selection-end-line="631" selection-end-column="11" />
332
+ <folding />
333
+ </state>
334
+ </provider>
335
+ </entry>
336
+ <entry file="file://$PROJECT_DIR$/lib/ext_logger/logger.rb">
337
+ <provider selected="true" editor-type-id="text-editor">
338
+ <state relative-caret-position="540">
339
+ <caret line="36" column="9" lean-forward="false" selection-start-line="36" selection-start-column="9" selection-end-line="36" selection-end-column="9" />
340
+ <folding />
341
+ </state>
342
+ </provider>
343
+ </entry>
344
+ <entry file="file://$PROJECT_DIR$/lib/ext_logger/version.rb">
345
+ <provider selected="true" editor-type-id="text-editor">
346
+ <state relative-caret-position="30">
347
+ <caret line="2" column="13" lean-forward="false" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="18" />
348
+ <folding />
349
+ </state>
350
+ </provider>
351
+ </entry>
352
+ <entry file="file://$PROJECT_DIR$/README.md">
353
+ <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
354
+ <state split_layout="SPLIT">
355
+ <first_editor relative-caret-position="75">
356
+ <caret line="5" column="75" lean-forward="false" selection-start-line="5" selection-start-column="75" selection-end-line="5" selection-end-column="75" />
357
+ <folding />
358
+ </first_editor>
359
+ <second_editor />
360
+ </state>
361
+ </provider>
362
+ </entry>
363
+ <entry file="file://$PROJECT_DIR$/ext_logger.gemspec">
364
+ <provider selected="true" editor-type-id="text-editor">
365
+ <state relative-caret-position="300">
366
+ <caret line="20" column="31" lean-forward="false" selection-start-line="20" selection-start-column="31" selection-end-line="20" selection-end-column="31" />
367
+ <folding />
368
+ </state>
369
+ </provider>
370
+ </entry>
371
+ <entry file="file://$PROJECT_DIR$/Gemfile">
372
+ <provider selected="true" editor-type-id="text-editor">
373
+ <state relative-caret-position="0">
374
+ <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
375
+ <folding />
376
+ </state>
377
+ </provider>
378
+ </entry>
379
+ <entry file="file://$USER_HOME$/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/logger.rb">
380
+ <provider selected="true" editor-type-id="text-editor">
381
+ <state relative-caret-position="9465">
382
+ <caret line="631" column="11" lean-forward="false" selection-start-line="631" selection-start-column="4" selection-end-line="631" selection-end-column="11" />
383
+ <folding />
384
+ </state>
385
+ </provider>
386
+ </entry>
387
+ <entry file="file://$PROJECT_DIR$/lib/ext_logger/logger.rb">
388
+ <provider selected="true" editor-type-id="text-editor">
389
+ <state relative-caret-position="540">
390
+ <caret line="36" column="9" lean-forward="true" selection-start-line="36" selection-start-column="9" selection-end-line="36" selection-end-column="9" />
391
+ <folding />
392
+ </state>
393
+ </provider>
394
+ </entry>
245
395
  <entry file="file://$PROJECT_DIR$/ext_logger.gemspec">
246
396
  <provider selected="true" editor-type-id="text-editor">
247
397
  <state relative-caret-position="240">
@@ -342,45 +492,34 @@
342
492
  </state>
343
493
  </provider>
344
494
  </entry>
345
- <entry file="file://$PROJECT_DIR$/README.md">
346
- <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
347
- <state split_layout="SPLIT">
348
- <first_editor relative-caret-position="75">
349
- <caret line="5" column="75" lean-forward="false" selection-start-line="5" selection-start-column="75" selection-end-line="5" selection-end-column="75" />
350
- <folding />
351
- </first_editor>
352
- <second_editor />
353
- </state>
354
- </provider>
355
- </entry>
356
- <entry file="file://$USER_HOME$/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/logger.rb">
495
+ <entry file="file://$PROJECT_DIR$/Gemfile">
357
496
  <provider selected="true" editor-type-id="text-editor">
358
- <state relative-caret-position="227">
359
- <caret line="631" column="11" lean-forward="false" selection-start-line="631" selection-start-column="4" selection-end-line="631" selection-end-column="11" />
497
+ <state relative-caret-position="0">
498
+ <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
360
499
  <folding />
361
500
  </state>
362
501
  </provider>
363
502
  </entry>
364
- <entry file="file://$PROJECT_DIR$/lib/ext_logger/logger.rb">
503
+ <entry file="file://$APPLICATION_HOME_DIR$/rubystubs23/object.rb">
365
504
  <provider selected="true" editor-type-id="text-editor">
366
- <state relative-caret-position="416">
367
- <caret line="56" column="47" lean-forward="false" selection-start-line="56" selection-start-column="47" selection-end-line="56" selection-end-column="47" />
505
+ <state relative-caret-position="0">
506
+ <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
368
507
  <folding />
369
508
  </state>
370
509
  </provider>
371
510
  </entry>
372
- <entry file="file://$PROJECT_DIR$/Gemfile">
511
+ <entry file="file://$USER_HOME$/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/logger.rb">
373
512
  <provider selected="true" editor-type-id="text-editor">
374
- <state relative-caret-position="0">
375
- <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
513
+ <state relative-caret-position="2558">
514
+ <caret line="788" column="38" lean-forward="false" selection-start-line="788" selection-start-column="13" selection-end-line="788" selection-end-column="38" />
376
515
  <folding />
377
516
  </state>
378
517
  </provider>
379
518
  </entry>
380
519
  <entry file="file://$PROJECT_DIR$/lib/ext_logger/version.rb">
381
520
  <provider selected="true" editor-type-id="text-editor">
382
- <state relative-caret-position="30">
383
- <caret line="2" column="13" lean-forward="false" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="18" />
521
+ <state relative-caret-position="60">
522
+ <caret line="4" column="0" lean-forward="true" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
384
523
  <folding />
385
524
  </state>
386
525
  </provider>
@@ -388,7 +527,26 @@
388
527
  <entry file="file://$PROJECT_DIR$/ext_logger.gemspec">
389
528
  <provider selected="true" editor-type-id="text-editor">
390
529
  <state relative-caret-position="225">
391
- <caret line="15" column="68" lean-forward="true" selection-start-line="15" selection-start-column="68" selection-end-line="15" selection-end-column="68" />
530
+ <caret line="15" column="219" lean-forward="false" selection-start-line="15" selection-start-column="219" selection-end-line="15" selection-end-column="219" />
531
+ <folding />
532
+ </state>
533
+ </provider>
534
+ </entry>
535
+ <entry file="file://$PROJECT_DIR$/README.md">
536
+ <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
537
+ <state split_layout="SPLIT">
538
+ <first_editor relative-caret-position="435">
539
+ <caret line="29" column="95" lean-forward="false" selection-start-line="29" selection-start-column="95" selection-end-line="29" selection-end-column="95" />
540
+ <folding />
541
+ </first_editor>
542
+ <second_editor />
543
+ </state>
544
+ </provider>
545
+ </entry>
546
+ <entry file="file://$PROJECT_DIR$/lib/ext_logger/logger.rb">
547
+ <provider selected="true" editor-type-id="text-editor">
548
+ <state relative-caret-position="278">
549
+ <caret line="228" column="28" lean-forward="true" selection-start-line="228" selection-start-column="28" selection-end-line="228" selection-end-column="28" />
392
550
  <folding />
393
551
  </state>
394
552
  </provider>
data/README.md CHANGED
@@ -27,7 +27,7 @@ Or install it yourself as:
27
27
  1. Initialization object (It automatically creates non-existent directories based on paths):
28
28
 
29
29
  ```ruby
30
- logger = ExtLogger.new(log_path)
30
+ logger = ExtLogger.new(log_path, {age: 7/'weekly', size: 1024000, split_format: '%Y%m%d%H%M'})
31
31
  ```
32
32
 
33
33
  2. Output of normal log (Extended logger.info):
@@ -57,8 +57,8 @@ Or install it yourself as:
57
57
  6. Output of memory usage (Extended logger.warn):
58
58
 
59
59
  ```ruby
60
- logger.record_memory
61
- logger.record_memory('end')
60
+ logger.record_memory # at the begin of programme
61
+ logger.record_memory('end') # at the end of programme
62
62
  ```
63
63
 
64
64
  ## Development
data/ext_logger.gemspec CHANGED
@@ -11,8 +11,9 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{Extended Logger class, log output to console in non-production environment.}
13
13
  spec.description = %q{
14
- Extended Logger class, log output to console in non-production environment.
15
- Additional instance method ‘record_memory’ to record memory consumption.
14
+ Extended Logger class, log output to console in non-production environment.\n
15
+ Additional instance method ‘record_memory’ to record memory consumption.\n
16
+ 2018-12-06(0.2.0): The internal structure changes greatly, adding hash parameters: age (shift_age with Logger object), size (shift_size with Logger object), split_format (log file output according to Ruby time format).\n
16
17
  2018-11-28(0.1.3): Fixed a path problem during log initialization.
17
18
  }
18
19
  spec.homepage = ""
@@ -1,111 +1,111 @@
1
1
  require 'logger'
2
2
  # require 'rails'
3
3
 
4
- class ExtLogger < Logger
5
- @output_flag = true # flag of output to console
4
+ class ExtLogger
6
5
 
7
- # set output flag
8
- def self.set_output(type=true)
9
- @output_flag = type
10
- end
6
+ DATE_FORMAT_MEMBER_LIST = %w(%Y %y %m %d %wday %H %M %S)
7
+ LOG_NAME = '{log_name}' # log name pseudo-code
8
+ ENV_HASH = {
9
+ dev: 'development',
10
+ stg: 'staging',
11
+ pro: 'production',
12
+ }
11
13
 
12
- # check output flag & env
13
- def self.output?
14
- if @output_flag
15
- return ExtLogger.env != 'production'
16
- end
17
- return false
18
- end
14
+ @debug = false
15
+ @logger = nil
16
+ @log_path = ''
17
+ @log_split_format = '' # log name postfix, default blank.
18
+ @output_flag = true # flag of output to console
19
19
 
20
- # validation the Rails object
21
- def self.valid_rails
22
- defined?(::Rails)
23
- end
20
+ # new / initialize
21
+ def initialize(*args)
22
+ func_name = "[#{self.to_s}.initialize]"
23
+ dput "#{func_name} args.size: #{args.size}"
24
+ init(args[0]) if args.size == 1
24
25
 
25
- # get the path of folder or rails project
26
- def self.root
27
- self.valid_rails && ::Rails.root ? ::Rails.root.to_s : ::Dir.pwd
28
- end
26
+ if args.size == 2
27
+ opt = args[1].clone
28
+ if opt.is_a?(Hash)
29
+ init(args[0], opt)
30
+ args = [args[0]]
29
31
 
30
- # get the env
31
- def self.env
32
- self.valid_rails && ::Rails.env ? ::Rails.env : 'development'
33
- end
32
+ shift_age = is_blank?(opt[:age]) ? opt[:age] : 0
33
+ args << shift_age
34
34
 
35
- def self.new(*args)
36
- self.init(args[0]) if args.size > 0
37
- super
35
+ shift_size = is_blank?(opt[:size]) ? opt[:size] : 0
36
+ args << shift_size
37
+ else
38
+ init(args[0])
39
+ end
40
+ end
41
+
42
+ @logger = Logger.new(*args)
38
43
  end
39
44
 
40
- def self.initialize(*args)
41
- self.init(args[0]) if args.size > 0
42
- super
45
+ # set debug
46
+ def set_debug(_bool=true)
47
+ @debug = _bool
43
48
  end
44
49
 
45
- def self.init(*args)
46
- if args.size > 0
47
- if args[0].is_a?(String)
48
- rails_flag = false
49
- if args[0].include?(self.root)
50
- path = args[0].gsub(self.root, '')
51
- path = '/log/' + path if !path.include?('log/')
52
- path = path.gsub('//', '/')
53
- rails_flag = true
54
- else
55
- path = args[0]
56
- end
57
- path = path.gsub('./', ::Dir.pwd + '/')
58
- # 检查目录存在否
59
- if !::Dir.exist?(path)
60
- path_array = path.split('/').select{|item| !item.nil? && item != ''}
61
- path = rails_flag ? self.root : ''
62
-
63
- path_array.each_with_index do |item, idx|
64
- break if idx >= path_array.length - 1
65
- path += '/' + item
66
- ::Dir.mkdir(path) if !::Dir.exist?(path)
67
- end
68
- end
69
- end
70
- end
50
+ # set output flag
51
+ def set_output_flag(type=true)
52
+ @output_flag = type
71
53
  end
72
54
 
73
55
  # output info
74
56
  def info(*args)
75
- if ExtLogger.output? && args.size > 0
76
- puts "INFO: #{args[0]}" if args[0].is_a?(String)
77
- end
78
- super
57
+ put_to_console('INFO', *args)
58
+
59
+ @logger.info(*args)
79
60
  end
80
61
 
81
62
  # output debug
82
63
  def debug(*args)
83
- if ExtLogger.output? && args.size > 0
84
- puts "DEBUG: #{args[0]}" if args[0].is_a?(String)
85
- end
86
- super
64
+ put_to_console('DEBUG', *args)
65
+
66
+ @logger.debug(*args)
87
67
  end
88
68
 
89
69
  # output error
90
70
  def error(*args)
91
- if ExtLogger.output? && args.size > 0
92
- puts "ERROR: #{args[0]}" if args[0].is_a?(String)
93
- end
94
- super
71
+ put_to_console('ERROR', *args)
72
+
73
+ @logger.error(*args)
95
74
  end
96
75
 
97
76
  # output warning
98
77
  def warn(*args)
99
- if ExtLogger.output? && args.size > 0
100
- puts "WARN: #{args[0]}" if args[0].is_a?(String)
78
+ put_to_console('WARN', *args)
79
+
80
+ @logger.warn(*args)
81
+ end
82
+
83
+ # output fatal
84
+ def fatal(*args)
85
+ put_to_console('FATAL', *args)
86
+
87
+ @logger.fatal(*args)
88
+ end
89
+
90
+ # output exception
91
+ def exception(*args)
92
+ func_name = "[@logger.EXCEPTION]"
93
+
94
+ if args.size == 1
95
+ dput "#{func_name} args[0].class: #{args[0].class}"
96
+ str = args[0].message + args[0].backtrace.join("\n")
97
+ args = [str]
101
98
  end
102
- super
99
+ put_to_console('EXCEPTION', *args)
100
+
101
+ @logger.error(*args)
103
102
  end
104
103
 
105
104
  # output the memory usage
106
105
  # example: record_memory()
107
106
  # example: record_memory('end')
108
107
  def record_memory(type='start')
108
+ func_name = "[@logger.record_memory]"
109
109
  begin
110
110
  type_list = %w(start end)
111
111
  @record_memory_error ||= 0
@@ -149,5 +149,162 @@ class ExtLogger < Logger
149
149
  end
150
150
  end
151
151
 
152
+ private
153
+ # private function for initialize
154
+ def init(path, opt={})
155
+ func_name = "[#{self.to_s}.init]"
156
+ @debug = true if opt[:debug]
157
+
158
+ dput "#{func_name} path: #{path}, opt: #{opt}"
159
+ _path = ''
160
+ if path.is_a?(String)
161
+ rails_flag = false
162
+ if path.include?(rails_root)
163
+ _path = path.gsub(rails_root, '')
164
+ _path = '/log/' + _path if !_path.include?('log/')
165
+ _path = _path.gsub('//', '/')
166
+ rails_flag = true
167
+ else
168
+ _path = path
169
+ end
170
+ _path = _path.gsub('./', ::Dir.pwd + '/')
171
+ set_path(_path) # save original log path with postfix
172
+ end
173
+
174
+ # check the directory is exist.
175
+ if !::Dir.exist?(_path)
176
+ _path_array = _path.split('/').select{|item| !item.nil? && item != ''}
177
+ _path = rails_flag ? rails_root : ''
178
+
179
+ _path_array.each_with_index do |item, idx|
180
+ break if idx >= _path_array.length - 1
181
+ _path += '/' + item
182
+ ::Dir.mkdir(_path) if !::Dir.exist?(_path)
183
+ end
184
+ end
185
+
186
+ # process parameters
187
+ if !is_blank?(opt[:split_format])
188
+ set_split_format(opt[:split_format])
189
+ end
190
+ dput "#{func_name} split_format: #{get_split_format}"
191
+ end
192
+
193
+
194
+ # check postfix contain the format member
195
+ def has_date_format_member
196
+ func_name = "[#{self.to_s}.has_date_format_member]"
197
+
198
+ _has_flag = false
199
+ return _has_flag if is_blank?(@log_split_format) || !@log_split_format.include?('%')
200
+
201
+ DATE_FORMAT_MEMBER_LIST.each do |item|
202
+ if @log_split_format.include?(item)
203
+ _has_flag = true
204
+ break
205
+ end
206
+ end
207
+
208
+ dput "#{func_name} @log_split_format: #{@log_split_format}, _has_flag: #{_has_flag}"
209
+ return _has_flag
210
+ end
211
+
212
+ # split log file
213
+ def split_file
214
+ func_name = "[#{self.to_s}.split_file]"
215
+ if has_date_format_member
216
+ _file_path = get_path
217
+ _file_ext = ''
218
+
219
+ if _file_path.include?('.')
220
+ _file_array = _file_path.split('.')
221
+ _file_ext = _file_array.last
222
+ end
223
+
224
+ if File.exist?(_file_path)
225
+ # get create datetime of file
226
+ _file_date = File.ctime(_file_path)
227
+ dput "#{func_name} Current log ctime: ##{_file_date}, mtime: #{File.atime(_file_path)}, atime: #{File.mtime(_file_path)}"
228
+
229
+ _now_time = Time.now
230
+ _split_format = get_split_format.gsub('%S', '')
231
+ dput "#{func_name} _now_time: #{_now_time.strftime(_split_format)}"
232
+ if _file_date.strftime(_split_format) != _now_time.strftime(_split_format)
233
+ @logger.close
234
+
235
+ _tmp_path = _file_path.clone
236
+ _tmp_path = _tmp_path.gsub(".#{_file_ext}", '') if !is_blank?(_file_ext)
237
+ _old_path = _tmp_path + _now_time.strftime(_split_format)
238
+ _old_path += '.' + _file_ext if !is_blank?(_file_ext)
239
+
240
+ File.delete(_old_path) if File.exist?(_old_path)
241
+ File.rename(_file_path, _old_path)
242
+
243
+ @logger = Logger.new(get_path)
244
+ end
245
+ end
246
+ end
247
+ end
248
+
249
+ # check output flag & env
250
+ def put_to_console(*args)
251
+ _flag = false
252
+ _flag = rails_env != ENV_HASH[:pro] if @output_flag
253
+
254
+ if args.size > 1
255
+ func_name = "[@logger.#{args[0]}]"
256
+ dput "#{func_name} *args: #{args}"
257
+
258
+ puts "#{args[0]}: #{args[1]}" if args[1].is_a?(String)
259
+ end
260
+ split_file # split file with split_format
261
+ end
262
+
263
+ # set log path
264
+ def set_path(str)
265
+ @log_path = str
266
+ end
267
+
268
+ # get log path
269
+ def get_path
270
+ return @log_path
271
+ end
272
+
273
+ # set format for log name
274
+ def set_split_format(str)
275
+ @log_split_format = "_#{str.to_s}" if str.is_a?(String) && !is_blank?(str)
276
+ end
277
+
278
+ def get_split_format
279
+ return @log_split_format
280
+ end
281
+
282
+ # validation the Rails object
283
+ def valid_rails
284
+ defined?(::Rails)
285
+ end
286
+
287
+ # get the path of folder or rails project
288
+ def rails_root
289
+ valid_rails && ::Rails.root ? ::Rails.root.to_s : ::Dir.pwd
290
+ end
291
+
292
+ # get the env
293
+ def rails_env
294
+ valid_rails && ::Rails.env ? ::Rails.env : ENV_HASH[:dev]
295
+ end
296
+
297
+ def is_blank?(obj)
298
+ func_name = "[#{self.to_s}.is_blank?]"
299
+ # dput "#{func_name} obj.class: #{obj.class}"
300
+ return true if obj.nil?
301
+ return (obj.is_a?(String) || obj.is_a?(Array) || obj.is_a?(Hash)) && obj.empty?
302
+ end
303
+
304
+ # puts to console by debug=true
305
+ def dput(str)
306
+ puts str if @debug
307
+ end
308
+
152
309
  end
153
310
 
@@ -1,4 +1,4 @@
1
1
  require 'logger'
2
2
  class ExtLogger < Logger
3
- VERSION = "0.1.3"
3
+ VERSION = "0.2.0"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ext_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruby
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-28 00:00:00.000000000 Z
11
+ date: 2018-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -40,8 +40,9 @@ dependencies:
40
40
  version: '10.0'
41
41
  description: |2
42
42
 
43
- Extended Logger class, log output to console in non-production environment.
44
- Additional instance method ‘record_memory’ to record memory consumption.
43
+ Extended Logger class, log output to console in non-production environment.\n
44
+ Additional instance method ‘record_memory’ to record memory consumption.\n
45
+ 2018-12-06(0.2.0): The internal structure changes greatly, adding hash parameters: age (shift_age with Logger object), size (shift_size with Logger object), split_format (log file output according to Ruby time format).\n
45
46
  2018-11-28(0.1.3): Fixed a path problem during log initialization.
46
47
  email:
47
48
  - wu.chao@maisiteng.com