rbatch 1.6.6 → 1.7.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.
- data/README.ja.md +11 -11
- data/README.md +12 -12
- data/Rakefile +2 -2
- data/doc/rdoc/CHANGELOG.html +144 -163
- data/doc/rdoc/LICENSE.html +79 -73
- data/doc/rdoc/RBatch/Cmd.html +293 -308
- data/doc/rdoc/RBatch/CmdException.html +141 -140
- data/doc/rdoc/RBatch/CmdResult.html +462 -469
- data/doc/rdoc/RBatch/Config.html +314 -329
- data/doc/rdoc/RBatch/Log.html +677 -709
- data/doc/rdoc/RBatch.html +425 -432
- data/doc/rdoc/created.rid +8 -8
- data/doc/rdoc/index.html +123 -117
- data/doc/rdoc/lib/rbatch/cmd_rb.html +42 -42
- data/doc/rdoc/lib/rbatch/config_rb.html +42 -42
- data/doc/rdoc/lib/rbatch/log_rb.html +44 -44
- data/doc/rdoc/lib/rbatch_rb.html +44 -44
- data/doc/rdoc/rdoc.css +365 -308
- data/lib/rbatch/log.rb +13 -3
- data/sample/bin/log_backup.rb +20 -0
- data/sample/conf/log_backup.yaml +4 -0
- data/sample/log/20130129_log_backup.log +95 -0
- data/test/cases/test_log.rb +0 -7
- metadata +6 -3
data/doc/rdoc/RBatch/Log.html
CHANGED
@@ -1,742 +1,710 @@
|
|
1
|
-
<?xml version="1.0" encoding="
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
-
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
4
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
5
|
<head>
|
6
|
-
|
6
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
7
7
|
|
8
|
-
|
8
|
+
<title>Class: RBatch::Log</title>
|
9
9
|
|
10
|
-
|
10
|
+
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
<script src="../js/quicksearch.js" type="text/javascript"
|
17
|
-
charset="utf-8"></script>
|
18
|
-
<script src="../js/darkfish.js" type="text/javascript"
|
19
|
-
charset="utf-8"></script>
|
12
|
+
<script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
13
|
+
<script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
14
|
+
<script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
15
|
+
<script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
20
16
|
|
21
17
|
</head>
|
22
|
-
<body class="class">
|
18
|
+
<body id="top" class="class">
|
23
19
|
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
<div id="metadata">
|
21
|
+
<div id="home-metadata">
|
22
|
+
<div id="home-section" class="section">
|
27
23
|
<h3 class="section-header">
|
28
24
|
<a href="../index.html">Home</a>
|
29
25
|
<a href="../index.html#classes">Classes</a>
|
30
26
|
<a href="../index.html#methods">Methods</a>
|
31
27
|
</h3>
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
<
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
<a href="Log.html">Log</a>
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div id="file-metadata">
|
32
|
+
<div id="file-list-section" class="section">
|
33
|
+
<h3 class="section-header">In Files</h3>
|
34
|
+
<div class="section-body">
|
35
|
+
<ul>
|
36
|
+
|
37
|
+
<li><a href="../lib/rbatch/log_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
+
class="thickbox" title="lib/rbatch/log.rb">lib/rbatch/log.rb</a></li>
|
39
|
+
|
40
|
+
</ul>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div id="class-metadata">
|
48
|
+
|
49
|
+
<!-- Parent Class -->
|
50
|
+
<div id="parent-class-section" class="section">
|
51
|
+
<h3 class="section-header">Parent</h3>
|
52
|
+
|
53
|
+
<p class="link">Object</p>
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
<!-- Method Quickref -->
|
64
|
+
<div id="method-list-section" class="section">
|
65
|
+
<h3 class="section-header">Methods</h3>
|
66
|
+
<ul class="link-list">
|
67
|
+
|
68
|
+
<li><a href="#method-c-new">::new</a></li>
|
69
|
+
|
70
|
+
<li><a href="#method-c-verbose">::verbose</a></li>
|
71
|
+
|
72
|
+
<li><a href="#method-c-verbose-3D">::verbose=</a></li>
|
73
|
+
|
74
|
+
<li><a href="#method-i-close">#close</a></li>
|
75
|
+
|
76
|
+
<li><a href="#method-i-debug">#debug</a></li>
|
77
|
+
|
78
|
+
<li><a href="#method-i-delete_old_log">#delete_old_log</a></li>
|
79
|
+
|
80
|
+
<li><a href="#method-i-error">#error</a></li>
|
81
|
+
|
82
|
+
<li><a href="#method-i-fatal">#fatal</a></li>
|
83
|
+
|
84
|
+
<li><a href="#method-i-info">#info</a></li>
|
85
|
+
|
86
|
+
<li><a href="#method-i-opt">#opt</a></li>
|
87
|
+
|
88
|
+
<li><a href="#method-i-warn">#warn</a></li>
|
89
|
+
|
90
|
+
</ul>
|
91
|
+
</div>
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
<div id="project-metadata">
|
98
|
+
|
99
|
+
|
100
|
+
<div id="fileindex-section" class="section project-section">
|
101
|
+
<h3 class="section-header">Files</h3>
|
102
|
+
<ul>
|
103
|
+
|
104
|
+
<li class="file"><a href="../CHANGELOG.html">CHANGELOG</a></li>
|
105
|
+
|
106
|
+
<li class="file"><a href="../LICENSE.html">LICENSE</a></li>
|
107
|
+
|
108
|
+
</ul>
|
109
|
+
</div>
|
110
|
+
|
111
|
+
|
112
|
+
<div id="classindex-section" class="section project-section">
|
113
|
+
<h3 class="section-header">Class/Module Index
|
114
|
+
<span class="search-toggle"><img src="../images/find.png"
|
115
|
+
height="16" width="16" alt="[+]"
|
116
|
+
title="show/hide quicksearch" /></span></h3>
|
117
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
118
|
+
<fieldset>
|
119
|
+
<legend>Quicksearch</legend>
|
120
|
+
<input type="text" name="quicksearch" value=""
|
121
|
+
class="quicksearch-field" />
|
122
|
+
</fieldset>
|
123
|
+
</form>
|
124
|
+
|
125
|
+
<ul class="link-list">
|
126
|
+
|
127
|
+
<li><a href="../RBatch.html">RBatch</a></li>
|
128
|
+
|
129
|
+
<li><a href="../RBatch/Cmd.html">RBatch::Cmd</a></li>
|
130
|
+
|
131
|
+
<li><a href="../RBatch/CmdException.html">RBatch::CmdException</a></li>
|
132
|
+
|
133
|
+
<li><a href="../RBatch/CmdResult.html">RBatch::CmdResult</a></li>
|
134
|
+
|
135
|
+
<li><a href="../RBatch/Config.html">RBatch::Config</a></li>
|
136
|
+
|
137
|
+
<li><a href="../RBatch/Log.html">RBatch::Log</a></li>
|
138
|
+
|
139
|
+
<li><a href="../RBatch/RBatch.html">RBatch::RBatch</a></li>
|
140
|
+
|
141
|
+
<li><a href="../RBatch/RBatch/RBatch.html">RBatch::RBatch::RBatch</a></li>
|
142
|
+
|
143
|
+
<li><a href="../RBatch/RBatch/RBatch/Config.html">RBatch::RBatch::RBatch::Config</a></li>
|
144
|
+
|
145
|
+
<li><a href="../RBatch/RBatch/RBatch/Config/Exception.html">RBatch::RBatch::RBatch::Config::Exception</a></li>
|
146
|
+
|
147
|
+
</ul>
|
148
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
149
|
+
</div>
|
150
|
+
|
151
|
+
|
152
|
+
</div>
|
153
|
+
</div>
|
154
|
+
|
155
|
+
<div id="documentation">
|
156
|
+
<h1 class="class">RBatch::Log</h1>
|
157
|
+
|
158
|
+
<div id="description" class="description">
|
159
|
+
|
160
|
+
<h3>About <a href="Log.html">RBatch::Log</a></h3>
|
161
|
+
|
162
|
+
<p>Use Auto Logging block, <a href="RBatch.html">RBatch</a> automatically
|
163
|
+
write to logfile.</p>
|
164
|
+
|
165
|
+
<p><a href="Log.html">Log</a> file default location is
|
166
|
+
"../log/YYYYMMDD_HHMMSS_${PROG_NAME}.log" .</p>
|
167
|
+
|
168
|
+
<p>If exception occuerd, then <a href="RBatch.html">RBatch</a> write stack
|
169
|
+
trace to logfile.</p>
|
170
|
+
|
171
171
|
<h3>Sample</h3>
|
172
|
-
|
173
|
-
script : ./bin/sample1.rb
|
174
|
-
|
175
|
-
<pre>
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
</
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
172
|
+
|
173
|
+
<p>script : ./bin/sample1.rb</p>
|
174
|
+
|
175
|
+
<pre>require 'rbatch'
|
176
|
+
|
177
|
+
RBatch::Log.new(){ |log| # Logging block
|
178
|
+
log.info "info string"
|
179
|
+
log.error "error string"
|
180
|
+
raise "exception"
|
181
|
+
}</pre>
|
182
|
+
|
183
|
+
<p>logfile : ./log/20121020_005953_sample1.log</p>
|
184
|
+
|
185
|
+
<pre># Logfile created on 2012-10-20 00:59:53 +0900 by logger.rb/25413
|
186
|
+
I, [2012-10-20T00:59:53.895528 #3208] INFO -- : info string
|
187
|
+
E, [2012-10-20T00:59:53.895582 #3208] ERROR -- : error string
|
188
|
+
F, [2012-10-20T00:59:53.895629 #3208] FATAL -- : Caught exception; existing 1
|
189
|
+
F, [2012-10-20T00:59:53.895667 #3208] FATAL -- : exception (RuntimeError)
|
190
|
+
test.rb:6:in `block in <main>'
|
191
|
+
/usr/local/lib/ruby192/lib/ruby/gems/1.9.1/gems/rbatch-1.0.0/lib/rbatch/auto_logger.rb:37:in `initialize'
|
192
|
+
test.rb:3:in `new'
|
193
|
+
test.rb:3:in `<main>'</pre>
|
194
|
+
|
195
|
+
</div><!-- description -->
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
<div id="5Buntitled-5D" class="documentation-section">
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
<!-- Methods -->
|
210
|
+
|
211
|
+
<div id="public-class-method-details" class="method-section section">
|
212
|
+
<h3 class="section-header">Public Class Methods</h3>
|
213
|
+
|
214
|
+
|
215
|
+
<div id="new-method" class="method-detail ">
|
216
|
+
<a name="method-c-new"></a>
|
217
|
+
|
218
|
+
|
219
|
+
<div class="method-heading">
|
220
|
+
<span class="method-name">new</span><span
|
221
|
+
class="method-args">(opt = nil)</span>
|
222
|
+
<span class="method-click-advice">click to toggle source</span>
|
223
|
+
</div>
|
224
|
+
|
225
|
+
|
226
|
+
<div class="method-description">
|
227
|
+
|
228
|
+
<p>Auto Logging Block.</p>
|
229
|
+
|
228
230
|
<h4>Params</h4>
|
229
|
-
|
230
|
-
<tt>opt</tt> = Option hash object. Hash keys is follows
|
231
|
-
|
232
|
-
<
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
</
|
237
|
-
</
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
</li>
|
243
|
-
<
|
244
|
-
|
245
|
-
|
246
|
-
.
|
247
|
-
|
248
|
-
</li>
|
249
|
-
|
250
|
-
<tt>:append</tt> (Boolean) = appned to log or not(=overwrite). Default is
|
251
|
-
ture.
|
252
|
-
</p>
|
253
|
-
</li>
|
254
|
-
<li><p>
|
255
|
-
<tt>:formatter</tt> (Logger#formatter) = log formatter. instance of
|
256
|
-
Logger#formatter
|
257
|
-
</p>
|
258
|
-
</li>
|
259
|
-
<li><p>
|
260
|
-
<tt>:stdout</tt> (Boolean) = print string both logfile and STDOUT. Default
|
261
|
-
is false.
|
262
|
-
</p>
|
263
|
-
</li>
|
264
|
-
<li><p>
|
265
|
-
<tt>:quiet</tt> (Boolean) = run quiet mode. print STDOUT nothing. Default
|
266
|
-
is true.
|
267
|
-
</p>
|
268
|
-
</li>
|
269
|
-
</ul>
|
231
|
+
|
232
|
+
<p><tt>opt</tt> = Option hash object. Hash keys is follows.</p>
|
233
|
+
<ul><li>
|
234
|
+
<p><tt>:name</tt> (String) = log file name. Default is
|
235
|
+
"<date>_<time>_<prog>.log"</p>
|
236
|
+
</li><li>
|
237
|
+
<p><tt>:dir</tt> (String) = log direcotry path. Default is "../log"</p>
|
238
|
+
</li><li>
|
239
|
+
<p><tt>:level</tt> (String) = log level.
|
240
|
+
["debug"|"info"|"warn"|"error"|"fatal"] . Default is "info".</p>
|
241
|
+
</li><li>
|
242
|
+
<p><tt>:append</tt> (Boolean) = appned to log or not(=overwrite). Default is
|
243
|
+
ture.</p>
|
244
|
+
</li><li>
|
245
|
+
<p><tt>:stdout</tt> (Boolean) = print string both logfile and STDOUT. Default
|
246
|
+
is false.</p>
|
247
|
+
</li><li>
|
248
|
+
<p><tt>:quiet</tt> (Boolean) = run quiet mode. print STDOUT nothing. Default
|
249
|
+
is true.</p>
|
250
|
+
</li></ul>
|
251
|
+
|
270
252
|
<h4>Block params</h4>
|
271
|
-
|
272
|
-
<tt>log</tt> = Instance of <tt>Logger</tt>
|
273
|
-
|
253
|
+
|
254
|
+
<p><tt>log</tt> = Instance of <tt>Logger</tt></p>
|
255
|
+
|
274
256
|
<h4>Sample</h4>
|
257
|
+
|
258
|
+
<pre>RBatch::Log.new({:dir => "/tmp", :level => "info"}){ |log|
|
259
|
+
log.info "info string"
|
260
|
+
}</pre>
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
<div class="method-source-code" id="new-source">
|
275
265
|
<pre>
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
<
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
266
|
+
<span class="ruby-comment"># File lib/rbatch/log.rb, line 91</span>
|
267
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">opt</span> = <span class="ruby-keyword">nil</span>)
|
268
|
+
<span class="ruby-comment"># parse option</span>
|
269
|
+
<span class="ruby-ivar">@opt</span> = <span class="ruby-identifier">@@def_opt</span>.<span class="ruby-identifier">clone</span>
|
270
|
+
<span class="ruby-identifier">@@def_opt</span>.<span class="ruby-identifier">each_key</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
|
271
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opt</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">key</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span>
|
272
|
+
<span class="ruby-comment"># use argument</span>
|
273
|
+
<span class="ruby-ivar">@opt</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">key</span>]
|
274
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-constant">RBatch</span>.<span class="ruby-identifier">common_config</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">&&</span> <span class="ruby-constant">RBatch</span>.<span class="ruby-identifier">common_config</span>[<span class="ruby-string">"log_"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span>
|
275
|
+
<span class="ruby-comment"># use config</span>
|
276
|
+
<span class="ruby-ivar">@opt</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-constant">RBatch</span>.<span class="ruby-identifier">common_config</span>[<span class="ruby-string">"log_"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>]
|
277
|
+
<span class="ruby-keyword">else</span>
|
278
|
+
<span class="ruby-comment"># use default</span>
|
279
|
+
<span class="ruby-keyword">end</span>
|
280
|
+
<span class="ruby-keyword">end</span>
|
281
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"option = "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@opt</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">@@verbose</span>
|
282
|
+
<span class="ruby-comment"># determine log file name</span>
|
283
|
+
<span class="ruby-ivar">@prog_base</span> = <span class="ruby-constant">Pathname</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-constant">RBatch</span>.<span class="ruby-identifier">program_name</span>)).<span class="ruby-identifier">sub_ext</span>(<span class="ruby-string">""</span>).<span class="ruby-identifier">to_s</span>
|
284
|
+
<span class="ruby-ivar">@file_name</span> = <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:name</span>].<span class="ruby-identifier">clone</span>
|
285
|
+
<span class="ruby-ivar">@file_name</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-string">"<date>"</span>, <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-string">"%Y%m%d"</span>))
|
286
|
+
<span class="ruby-ivar">@file_name</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-string">"<time>"</span>, <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-string">"%H%M%S"</span>))
|
287
|
+
<span class="ruby-ivar">@file_name</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-string">"<prog>"</span>, <span class="ruby-ivar">@prog_base</span>)
|
288
|
+
<span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@opt</span>[<span class="ruby-value">:dir</span>],<span class="ruby-ivar">@file_name</span>)
|
289
|
+
<span class="ruby-comment"># create Logger instance</span>
|
290
|
+
<span class="ruby-keyword">begin</span>
|
291
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:append</span>] <span class="ruby-operator">&&</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">path</span>)
|
292
|
+
<span class="ruby-ivar">@log</span> = <span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">open</span>(<span class="ruby-identifier">path</span>,<span class="ruby-string">"a"</span>))
|
293
|
+
<span class="ruby-keyword">else</span>
|
294
|
+
<span class="ruby-ivar">@log</span> = <span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">open</span>(<span class="ruby-identifier">path</span>,<span class="ruby-string">"w"</span>))
|
295
|
+
<span class="ruby-keyword">end</span>
|
296
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
297
|
+
<span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"RBatch ERROR: Can not open log file - #{path}"</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:quiet</span>]
|
298
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
|
299
|
+
<span class="ruby-keyword">end</span>
|
300
|
+
<span class="ruby-comment"># set logger option</span>
|
301
|
+
<span class="ruby-identifier">formatter</span> = <span class="ruby-identifier">proc</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">severity</span>, <span class="ruby-identifier">datetime</span>, <span class="ruby-identifier">progname</span>, <span class="ruby-identifier">msg</span><span class="ruby-operator">|</span>
|
302
|
+
<span class="ruby-identifier">head</span> = <span class="ruby-node">"[#{datetime}] ["</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-string">"%-5s"</span>,<span class="ruby-identifier">severity</span>) <span class="ruby-operator">+</span><span class="ruby-string">"]"</span>
|
303
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">msg</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Exception</span>
|
304
|
+
<span class="ruby-node">"#{head} #{msg}\n"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">msg</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-node">" [backtrace] #{s}"</span>}.<span class="ruby-identifier">join</span>(<span class="ruby-string">"\n"</span>) <span class="ruby-operator">+</span> <span class="ruby-string">"\n"</span>
|
305
|
+
<span class="ruby-keyword">else</span>
|
306
|
+
<span class="ruby-node">"#{head} #{msg}\n"</span>
|
307
|
+
<span class="ruby-keyword">end</span>
|
308
|
+
<span class="ruby-keyword">end</span>
|
309
|
+
<span class="ruby-ivar">@log</span>.<span class="ruby-identifier">formatter</span> = <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:formatter</span>] <span class="ruby-keyword">if</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:formatter</span>]
|
310
|
+
<span class="ruby-ivar">@log</span>.<span class="ruby-identifier">level</span> = <span class="ruby-identifier">@@log_level_map</span>[<span class="ruby-ivar">@opt</span>[<span class="ruby-value">:level</span>]]
|
311
|
+
<span class="ruby-ivar">@log</span>.<span class="ruby-identifier">formatter</span> = <span class="ruby-identifier">formatter</span>
|
312
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:stdout</span>]
|
313
|
+
<span class="ruby-comment"># ccreate Logger instance for STDOUT</span>
|
314
|
+
<span class="ruby-ivar">@stdout_log</span> = <span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">STDOUT</span>)
|
315
|
+
<span class="ruby-ivar">@stdout_log</span>.<span class="ruby-identifier">formatter</span> = <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:formatter</span>] <span class="ruby-keyword">if</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:formatter</span>]
|
316
|
+
<span class="ruby-ivar">@stdout_log</span>.<span class="ruby-identifier">level</span> = <span class="ruby-identifier">@@log_level_map</span>[<span class="ruby-ivar">@opt</span>[<span class="ruby-value">:level</span>]]
|
317
|
+
<span class="ruby-ivar">@stdout_log</span>.<span class="ruby-identifier">formatter</span> = <span class="ruby-identifier">formatter</span>
|
318
|
+
<span class="ruby-keyword">end</span>
|
319
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"Log file: "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">path</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:quiet</span>]
|
320
|
+
<span class="ruby-comment"># delete old log</span>
|
321
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">delete_old_log</span>(<span class="ruby-ivar">@opt</span>[<span class="ruby-value">:delete_old_log_date</span>]) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:delete_old_log</span>]
|
322
|
+
<span class="ruby-comment"># Start logging</span>
|
323
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">"Start Logging. (PID=#{$$.to_s})"</span>) <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:quiet</span>]
|
324
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
|
325
|
+
<span class="ruby-keyword">begin</span>
|
326
|
+
<span class="ruby-keyword">yield</span> <span class="ruby-keyword">self</span>
|
327
|
+
<span class="ruby-keyword">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
328
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">fatal</span>(<span class="ruby-identifier">e</span>)
|
329
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">fatal</span>(<span class="ruby-string">"Caught exception. Exit 1"</span>)
|
330
|
+
<span class="ruby-identifier">exit</span> <span class="ruby-value">1</span>
|
331
|
+
<span class="ruby-keyword">ensure</span>
|
332
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">close</span>
|
333
|
+
<span class="ruby-keyword">end</span>
|
334
|
+
<span class="ruby-keyword">end</span>
|
335
|
+
<span class="ruby-keyword">end</span></pre>
|
336
|
+
</div><!-- new-source -->
|
337
|
+
|
338
|
+
</div>
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
</div><!-- new-method -->
|
344
|
+
|
345
|
+
|
346
|
+
<div id="verbose-method" class="method-detail ">
|
347
|
+
<a name="method-c-verbose"></a>
|
348
|
+
|
349
|
+
|
350
|
+
<div class="method-heading">
|
351
|
+
<span class="method-name">verbose</span><span
|
352
|
+
class="method-args">()</span>
|
353
|
+
<span class="method-click-advice">click to toggle source</span>
|
354
|
+
</div>
|
355
|
+
|
356
|
+
|
357
|
+
<div class="method-description">
|
358
|
+
|
359
|
+
<p>Get verbose mode flag.</p>
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
<div class="method-source-code" id="verbose-source">
|
374
364
|
<pre>
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
<div class="method-source-code"
|
407
|
-
id="verbose--source">
|
365
|
+
<span class="ruby-comment"># File lib/rbatch/log.rb, line 69</span>
|
366
|
+
<span class="ruby-keyword">def</span> <span class="ruby-constant">Log</span>.<span class="ruby-identifier">verbose</span> ; <span class="ruby-identifier">@@verbose</span> ; <span class="ruby-keyword">end</span></pre>
|
367
|
+
</div><!-- verbose-source -->
|
368
|
+
|
369
|
+
</div>
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
</div><!-- verbose-method -->
|
375
|
+
|
376
|
+
|
377
|
+
<div id="verbose-3D-method" class="method-detail ">
|
378
|
+
<a name="method-c-verbose-3D"></a>
|
379
|
+
|
380
|
+
|
381
|
+
<div class="method-heading">
|
382
|
+
<span class="method-name">verbose=</span><span
|
383
|
+
class="method-args">(bol)</span>
|
384
|
+
<span class="method-click-advice">click to toggle source</span>
|
385
|
+
</div>
|
386
|
+
|
387
|
+
|
388
|
+
<div class="method-description">
|
389
|
+
|
390
|
+
<p>Set verbose mode flag.</p>
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
<div class="method-source-code" id="verbose-3D-source">
|
408
395
|
<pre>
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
id="close-source">
|
396
|
+
<span class="ruby-comment"># File lib/rbatch/log.rb, line 66</span>
|
397
|
+
<span class="ruby-keyword">def</span> <span class="ruby-constant">Log</span>.<span class="ruby-identifier">verbose=</span>(<span class="ruby-identifier">bol</span>); <span class="ruby-identifier">@@verbose</span> = <span class="ruby-identifier">bol</span> ; <span class="ruby-keyword">end</span></pre>
|
398
|
+
</div><!-- verbose-3D-source -->
|
399
|
+
|
400
|
+
</div>
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
</div><!-- verbose-3D-method -->
|
406
|
+
|
407
|
+
|
408
|
+
</div><!-- public-class-method-details -->
|
409
|
+
|
410
|
+
<div id="public-instance-method-details" class="method-section section">
|
411
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
412
|
+
|
413
|
+
|
414
|
+
<div id="close-method" class="method-detail ">
|
415
|
+
<a name="method-i-close"></a>
|
416
|
+
|
417
|
+
|
418
|
+
<div class="method-heading">
|
419
|
+
<span class="method-name">close</span><span
|
420
|
+
class="method-args">()</span>
|
421
|
+
<span class="method-click-advice">click to toggle source</span>
|
422
|
+
</div>
|
423
|
+
|
424
|
+
|
425
|
+
<div class="method-description">
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
<div class="method-source-code" id="close-source">
|
446
432
|
<pre>
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
id="debug-source">
|
433
|
+
<span class="ruby-comment"># File lib/rbatch/log.rb, line 187</span>
|
434
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">close</span>
|
435
|
+
<span class="ruby-ivar">@stdout_log</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:stdout</span>]
|
436
|
+
<span class="ruby-ivar">@log</span>.<span class="ruby-identifier">close</span>
|
437
|
+
<span class="ruby-keyword">end</span></pre>
|
438
|
+
</div><!-- close-source -->
|
439
|
+
|
440
|
+
</div>
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
</div><!-- close-method -->
|
446
|
+
|
447
|
+
|
448
|
+
<div id="debug-method" class="method-detail ">
|
449
|
+
<a name="method-i-debug"></a>
|
450
|
+
|
451
|
+
|
452
|
+
<div class="method-heading">
|
453
|
+
<span class="method-name">debug</span><span
|
454
|
+
class="method-args">(a)</span>
|
455
|
+
<span class="method-click-advice">click to toggle source</span>
|
456
|
+
</div>
|
457
|
+
|
458
|
+
|
459
|
+
<div class="method-description">
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
<div class="method-source-code" id="debug-source">
|
481
466
|
<pre>
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
</p>
|
467
|
+
<span class="ruby-comment"># File lib/rbatch/log.rb, line 182</span>
|
468
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">debug</span>(<span class="ruby-identifier">a</span>)
|
469
|
+
<span class="ruby-ivar">@stdout_log</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-identifier">a</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:stdout</span>]
|
470
|
+
<span class="ruby-ivar">@log</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-identifier">a</span>)
|
471
|
+
<span class="ruby-keyword">end</span></pre>
|
472
|
+
</div><!-- debug-source -->
|
473
|
+
|
474
|
+
</div>
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
</div><!-- debug-method -->
|
480
|
+
|
481
|
+
|
482
|
+
<div id="delete_old_log-method" class="method-detail ">
|
483
|
+
<a name="method-i-delete_old_log"></a>
|
484
|
+
|
485
|
+
|
486
|
+
<div class="method-heading">
|
487
|
+
<span class="method-name">delete_old_log</span><span
|
488
|
+
class="method-args">(date = 7)</span>
|
489
|
+
<span class="method-click-advice">click to toggle source</span>
|
490
|
+
</div>
|
491
|
+
|
492
|
+
|
493
|
+
<div class="method-description">
|
494
|
+
|
495
|
+
<p>Delete old log files. If @<a href="http://:name">opt</a> is not include
|
496
|
+
“<date>”, then do nothing.</p>
|
497
|
+
|
514
498
|
<h4>Params</h4>
|
515
|
-
<ul>
|
516
|
-
<
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
<div class="method-source-code"
|
525
|
-
id="delete-old-log-source">
|
499
|
+
<ul><li>
|
500
|
+
<p><tt>date</tt> (Integer): The day of leaving log files</p>
|
501
|
+
</li></ul>
|
502
|
+
|
503
|
+
|
504
|
+
|
505
|
+
<div class="method-source-code" id="delete_old_log-source">
|
526
506
|
<pre>
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
id="error-source">
|
507
|
+
<span class="ruby-comment"># File lib/rbatch/log.rb, line 198</span>
|
508
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">delete_old_log</span>(<span class="ruby-identifier">date</span> = <span class="ruby-value">7</span>)
|
509
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-ivar">@opt</span>[<span class="ruby-value">:dir</span>]) <span class="ruby-operator">&&</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:name</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-string">"<date>"</span>)
|
510
|
+
<span class="ruby-constant">Dir</span><span class="ruby-operator">::</span><span class="ruby-identifier">foreach</span>(<span class="ruby-ivar">@opt</span>[<span class="ruby-value">:dir</span>]) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
|
511
|
+
<span class="ruby-identifier">r</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">"^"</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:name</span>].<span class="ruby-identifier">gsub</span>(<span class="ruby-string">"<prog>"</span>,<span class="ruby-ivar">@prog_base</span>) .<span class="ruby-identifier">gsub</span>(<span class="ruby-string">"<time>"</span>,<span class="ruby-string">"[0-2][0-9][0-5][0-9][0-5][0-9]"</span>) .<span class="ruby-identifier">gsub</span>(<span class="ruby-string">"<date>"</span>,<span class="ruby-string">"([0-9][0-9][0-9][0-9][0-1][0-9][0-3][0-9])"</span>) <span class="ruby-operator">+</span> <span class="ruby-string">"$"</span>)
|
512
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">r</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">file</span> <span class="ruby-operator">&&</span> <span class="ruby-constant">Date</span>.<span class="ruby-identifier">strptime</span>(<span class="ruby-node">$1</span>,<span class="ruby-string">"%Y%m%d"</span>) <span class="ruby-operator"><=</span> <span class="ruby-constant">Date</span>.<span class="ruby-identifier">today</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">date</span>
|
513
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"Delete old log file: "</span> <span class="ruby-operator">+</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@opt</span>[<span class="ruby-value">:dir</span>] , <span class="ruby-identifier">file</span>) <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:quiet</span>]
|
514
|
+
<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">delete</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@opt</span>[<span class="ruby-value">:dir</span>] , <span class="ruby-identifier">file</span>))
|
515
|
+
<span class="ruby-keyword">end</span>
|
516
|
+
<span class="ruby-keyword">end</span>
|
517
|
+
<span class="ruby-keyword">end</span>
|
518
|
+
<span class="ruby-keyword">end</span></pre>
|
519
|
+
</div><!-- delete_old_log-source -->
|
520
|
+
|
521
|
+
</div>
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
</div><!-- delete_old_log-method -->
|
527
|
+
|
528
|
+
|
529
|
+
<div id="error-method" class="method-detail ">
|
530
|
+
<a name="method-i-error"></a>
|
531
|
+
|
532
|
+
|
533
|
+
<div class="method-heading">
|
534
|
+
<span class="method-name">error</span><span
|
535
|
+
class="method-args">(a)</span>
|
536
|
+
<span class="method-click-advice">click to toggle source</span>
|
537
|
+
</div>
|
538
|
+
|
539
|
+
|
540
|
+
<div class="method-description">
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
|
546
|
+
<div class="method-source-code" id="error-source">
|
568
547
|
<pre>
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
id="fatal-source">
|
548
|
+
<span class="ruby-comment"># File lib/rbatch/log.rb, line 167</span>
|
549
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">error</span>(<span class="ruby-identifier">a</span>)
|
550
|
+
<span class="ruby-ivar">@stdout_log</span>.<span class="ruby-identifier">error</span>(<span class="ruby-identifier">a</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:stdout</span>]
|
551
|
+
<span class="ruby-ivar">@log</span>.<span class="ruby-identifier">error</span>(<span class="ruby-identifier">a</span>)
|
552
|
+
<span class="ruby-keyword">end</span></pre>
|
553
|
+
</div><!-- error-source -->
|
554
|
+
|
555
|
+
</div>
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
|
560
|
+
</div><!-- error-method -->
|
561
|
+
|
562
|
+
|
563
|
+
<div id="fatal-method" class="method-detail ">
|
564
|
+
<a name="method-i-fatal"></a>
|
565
|
+
|
566
|
+
|
567
|
+
<div class="method-heading">
|
568
|
+
<span class="method-name">fatal</span><span
|
569
|
+
class="method-args">(a)</span>
|
570
|
+
<span class="method-click-advice">click to toggle source</span>
|
571
|
+
</div>
|
572
|
+
|
573
|
+
|
574
|
+
<div class="method-description">
|
575
|
+
|
576
|
+
|
577
|
+
|
578
|
+
|
579
|
+
|
580
|
+
<div class="method-source-code" id="fatal-source">
|
603
581
|
<pre>
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
id="info-source">
|
582
|
+
<span class="ruby-comment"># File lib/rbatch/log.rb, line 162</span>
|
583
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">fatal</span>(<span class="ruby-identifier">a</span>)
|
584
|
+
<span class="ruby-ivar">@stdout_log</span>.<span class="ruby-identifier">fatal</span>(<span class="ruby-identifier">a</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:stdout</span>]
|
585
|
+
<span class="ruby-ivar">@log</span>.<span class="ruby-identifier">fatal</span>(<span class="ruby-identifier">a</span>)
|
586
|
+
<span class="ruby-keyword">end</span></pre>
|
587
|
+
</div><!-- fatal-source -->
|
588
|
+
|
589
|
+
</div>
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
|
594
|
+
</div><!-- fatal-method -->
|
595
|
+
|
596
|
+
|
597
|
+
<div id="info-method" class="method-detail ">
|
598
|
+
<a name="method-i-info"></a>
|
599
|
+
|
600
|
+
|
601
|
+
<div class="method-heading">
|
602
|
+
<span class="method-name">info</span><span
|
603
|
+
class="method-args">(a)</span>
|
604
|
+
<span class="method-click-advice">click to toggle source</span>
|
605
|
+
</div>
|
606
|
+
|
607
|
+
|
608
|
+
<div class="method-description">
|
609
|
+
|
610
|
+
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
<div class="method-source-code" id="info-source">
|
638
615
|
<pre>
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
<div class="method-source-code"
|
674
|
-
id="opt-source">
|
616
|
+
<span class="ruby-comment"># File lib/rbatch/log.rb, line 177</span>
|
617
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">info</span>(<span class="ruby-identifier">a</span>)
|
618
|
+
<span class="ruby-ivar">@stdout_log</span>.<span class="ruby-identifier">info</span>(<span class="ruby-identifier">a</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:stdout</span>]
|
619
|
+
<span class="ruby-ivar">@log</span>.<span class="ruby-identifier">info</span>(<span class="ruby-identifier">a</span>)
|
620
|
+
<span class="ruby-keyword">end</span></pre>
|
621
|
+
</div><!-- info-source -->
|
622
|
+
|
623
|
+
</div>
|
624
|
+
|
625
|
+
|
626
|
+
|
627
|
+
|
628
|
+
</div><!-- info-method -->
|
629
|
+
|
630
|
+
|
631
|
+
<div id="opt-method" class="method-detail ">
|
632
|
+
<a name="method-i-opt"></a>
|
633
|
+
|
634
|
+
|
635
|
+
<div class="method-heading">
|
636
|
+
<span class="method-name">opt</span><span
|
637
|
+
class="method-args">()</span>
|
638
|
+
<span class="method-click-advice">click to toggle source</span>
|
639
|
+
</div>
|
640
|
+
|
641
|
+
|
642
|
+
<div class="method-description">
|
643
|
+
|
644
|
+
<p>Get Option</p>
|
645
|
+
|
646
|
+
|
647
|
+
|
648
|
+
<div class="method-source-code" id="opt-source">
|
675
649
|
<pre>
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
id="warn-source">
|
650
|
+
<span class="ruby-comment"># File lib/rbatch/log.rb, line 72</span>
|
651
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">opt</span>; <span class="ruby-ivar">@opt</span> ; <span class="ruby-keyword">end</span></pre>
|
652
|
+
</div><!-- opt-source -->
|
653
|
+
|
654
|
+
</div>
|
655
|
+
|
656
|
+
|
657
|
+
|
658
|
+
|
659
|
+
</div><!-- opt-method -->
|
660
|
+
|
661
|
+
|
662
|
+
<div id="warn-method" class="method-detail ">
|
663
|
+
<a name="method-i-warn"></a>
|
664
|
+
|
665
|
+
|
666
|
+
<div class="method-heading">
|
667
|
+
<span class="method-name">warn</span><span
|
668
|
+
class="method-args">(a)</span>
|
669
|
+
<span class="method-click-advice">click to toggle source</span>
|
670
|
+
</div>
|
671
|
+
|
672
|
+
|
673
|
+
<div class="method-description">
|
674
|
+
|
675
|
+
|
676
|
+
|
677
|
+
|
678
|
+
|
679
|
+
<div class="method-source-code" id="warn-source">
|
707
680
|
<pre>
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
<div id="validator-badges">
|
736
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
737
|
-
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
738
|
-
Rdoc Generator</a> 1.1.6</small>.</p>
|
739
|
-
</div>
|
681
|
+
<span class="ruby-comment"># File lib/rbatch/log.rb, line 172</span>
|
682
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">warn</span>(<span class="ruby-identifier">a</span>)
|
683
|
+
<span class="ruby-ivar">@stdout_log</span>.<span class="ruby-identifier">warn</span>(<span class="ruby-identifier">a</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:stdout</span>]
|
684
|
+
<span class="ruby-ivar">@log</span>.<span class="ruby-identifier">warn</span>(<span class="ruby-identifier">a</span>)
|
685
|
+
<span class="ruby-keyword">end</span></pre>
|
686
|
+
</div><!-- warn-source -->
|
687
|
+
|
688
|
+
</div>
|
689
|
+
|
690
|
+
|
691
|
+
|
692
|
+
|
693
|
+
</div><!-- warn-method -->
|
694
|
+
|
695
|
+
|
696
|
+
</div><!-- public-instance-method-details -->
|
697
|
+
|
698
|
+
</div><!-- 5Buntitled-5D -->
|
699
|
+
|
700
|
+
|
701
|
+
</div><!-- documentation -->
|
702
|
+
|
703
|
+
<div id="validator-badges">
|
704
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
705
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
706
|
+
Rdoc Generator</a> 2</small>.</p>
|
707
|
+
</div>
|
740
708
|
|
741
709
|
</body>
|
742
710
|
</html>
|