prometheus-splash 0.5.3 → 0.6.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 +4 -4
- data/README.md +58 -60
- data/bin/splash +3 -0
- data/config/splash.yml +15 -2
- data/lib/splash/backends.rb +6 -0
- data/lib/splash/backends/file.rb +36 -0
- data/lib/splash/backends/redis.rb +44 -1
- data/lib/splash/cli.rb +7 -3
- data/lib/splash/cli/commands.rb +11 -4
- data/lib/splash/cli/config.rb +9 -1
- data/lib/splash/cli/daemon.rb +8 -1
- data/lib/splash/cli/documentation.rb +5 -2
- data/lib/splash/cli/logs.rb +14 -6
- data/lib/splash/cli/process.rb +9 -0
- data/lib/splash/cli/webadmin.rb +46 -0
- data/lib/splash/commands.rb +23 -2
- data/lib/splash/config.rb +141 -1
- data/lib/splash/config/flush.rb +9 -1
- data/lib/splash/config/sanitycheck.rb +6 -1
- data/lib/splash/config/service.rb +8 -1
- data/lib/splash/config/setup.rb +8 -3
- data/lib/splash/constants.rb +30 -2
- data/lib/splash/daemon.rb +5 -1
- data/lib/splash/daemon/controller.rb +21 -1
- data/lib/splash/daemon/metrics.rb +22 -7
- data/lib/splash/daemon/orchestrator.rb +21 -3
- data/lib/splash/daemon/orchestrator/grammar.rb +25 -5
- data/lib/splash/daemon/orchestrator/hooks.rb +10 -0
- data/lib/splash/dependencies.rb +10 -1
- data/lib/splash/exiter.rb +14 -0
- data/lib/splash/helpers.rb +69 -45
- data/lib/splash/loggers.rb +30 -4
- data/lib/splash/loggers/cli.rb +18 -3
- data/lib/splash/loggers/daemon.rb +14 -3
- data/lib/splash/loggers/dual.rb +14 -1
- data/lib/splash/loggers/web.rb +51 -0
- data/lib/splash/logs.rb +15 -4
- data/lib/splash/processes.rb +17 -5
- data/lib/splash/templates.rb +10 -0
- data/lib/splash/transports.rb +9 -0
- data/lib/splash/transports/rabbitmq.rb +33 -3
- data/lib/splash/webadmin.rb +122 -0
- data/lib/splash/webadmin/api/routes/commands.rb +28 -0
- data/lib/splash/webadmin/api/routes/config.rb +10 -0
- data/lib/splash/webadmin/api/routes/init.rb +2 -0
- data/lib/splash/webadmin/api/routes/logs.rb +59 -0
- data/lib/splash/webadmin/api/routes/process.rb +60 -0
- data/lib/splash/webadmin/main.rb +26 -0
- data/lib/splash/webadmin/portal/controllers/commands.rb +7 -0
- data/lib/splash/webadmin/portal/controllers/documentation.rb +6 -0
- data/lib/splash/webadmin/portal/controllers/home.rb +12 -0
- data/lib/splash/webadmin/portal/controllers/logs.rb +14 -0
- data/lib/splash/webadmin/portal/controllers/notfound.rb +5 -0
- data/lib/splash/webadmin/portal/controllers/processes.rb +14 -0
- data/lib/splash/webadmin/portal/controllers/proxy.rb +30 -0
- data/lib/splash/webadmin/portal/controllers/restclient.rb +19 -0
- data/lib/splash/webadmin/portal/init.rb +11 -0
- data/lib/splash/webadmin/portal/public/css/ultragreen.css +8544 -0
- data/lib/splash/webadmin/portal/public/fonts/FontAwesome.otf +0 -0
- data/lib/splash/webadmin/portal/public/fonts/fontawesome-webfont.ttf +0 -0
- data/lib/splash/webadmin/portal/public/fonts/fontawesome-webfont.woff +0 -0
- data/lib/splash/webadmin/portal/public/fonts/fontawesome-webfont.woff2 +0 -0
- data/lib/splash/webadmin/portal/public/images/logo_splash.png +0 -0
- data/lib/splash/webadmin/portal/public/images/logo_splash_reduce.png +0 -0
- data/lib/splash/webadmin/portal/public/images/logo_splash_tiny.png +0 -0
- data/lib/splash/webadmin/portal/views/commands.slim +49 -0
- data/lib/splash/webadmin/portal/views/documentation.slim +3 -0
- data/lib/splash/webadmin/portal/views/home.slim +78 -0
- data/lib/splash/webadmin/portal/views/layout.slim +43 -0
- data/lib/splash/webadmin/portal/views/logs.slim +32 -0
- data/lib/splash/webadmin/portal/views/nav.slim +17 -0
- data/lib/splash/webadmin/portal/views/not_found.slim +3 -0
- data/lib/splash/webadmin/portal/views/processes.slim +29 -0
- data/lib/splash/webadmin/portal/views/proxy.slim +13 -0
- data/lib/splash/webadmin/portal/views/restclient.slim +41 -0
- data/lib/splash/webadmin/portal/views/restclient_result.slim +29 -0
- data/prometheus-splash.gemspec +6 -0
- data/spec/helpers_spec.rb +119 -0
- metadata +128 -5
data/lib/splash/exiter.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
|
3
|
+
# base Splash namespace
|
2
4
|
module Splash
|
5
|
+
|
6
|
+
# Exiter namespace
|
3
7
|
module Exiter
|
4
8
|
include Splash::Loggers
|
5
9
|
EXIT_MAP= {
|
@@ -35,6 +39,10 @@ module Splash
|
|
35
39
|
|
36
40
|
}
|
37
41
|
|
42
|
+
# exiter wrapper
|
43
|
+
# @param [Hash] options
|
44
|
+
# @option options [Symbol] :case an exit case
|
45
|
+
# @option options [String] :more a complementary string to display
|
38
46
|
def splash_exit(options = {})
|
39
47
|
log = get_logger
|
40
48
|
mess = ""
|
@@ -50,7 +58,13 @@ module Splash
|
|
50
58
|
end
|
51
59
|
end
|
52
60
|
|
61
|
+
def splash_return(options = {})
|
53
62
|
|
63
|
+
data = EXIT_MAP[options[:case]]
|
64
|
+
data[:status] = (data[:code]>0)? :failure : :success
|
65
|
+
data[:more] = options[:more] if options[:more]
|
66
|
+
return data
|
67
|
+
end
|
54
68
|
|
55
69
|
end
|
56
70
|
end
|
data/lib/splash/helpers.rb
CHANGED
@@ -1,24 +1,30 @@
|
|
1
|
-
# @option options [String] :stdout_trace the path of the file where to redirect STDOUT
|
2
1
|
# coding: utf-8
|
2
|
+
|
3
|
+
# base Splash Module
|
3
4
|
module Splash
|
4
|
-
module Helpers
|
5
5
|
|
6
|
+
# Helpers namespace
|
7
|
+
module Helpers
|
6
8
|
|
7
9
|
|
10
|
+
# return the 'root' name
|
11
|
+
# @return [String] name
|
8
12
|
def user_root
|
9
13
|
return Etc.getpwuid(0).name
|
10
14
|
end
|
11
15
|
|
16
|
+
# return the 'root' group name : root or wheel
|
17
|
+
# @return [String] name
|
12
18
|
def group_root
|
13
19
|
return Etc.getgrgid(0).name
|
14
20
|
end
|
15
21
|
|
16
|
-
#
|
22
|
+
# facility for retreiving PID from process query
|
17
23
|
# @param [Hash] options
|
18
|
-
# @option options [String] :pattern
|
19
|
-
# @option options [Array] :patterns
|
20
|
-
# @option options [Bool] :full
|
21
|
-
# @return [String|Array]
|
24
|
+
# @option options [String] :pattern a regexp to search
|
25
|
+
# @option options [Array] :patterns an array of regexp to search
|
26
|
+
# @option options [Bool] :full flag to retrieve all process data not only PID
|
27
|
+
# @return [String|Array] PID or data structure
|
22
28
|
def get_processes(options = {})
|
23
29
|
patterns = []
|
24
30
|
patterns = options[:patterns] if options[:patterns]
|
@@ -35,7 +41,7 @@ module Splash
|
|
35
41
|
end
|
36
42
|
|
37
43
|
|
38
|
-
#
|
44
|
+
# facility to find a file in gem path
|
39
45
|
# @param [String] _gem a Gem name
|
40
46
|
# @param [String] _file a file relative path in the gem
|
41
47
|
# @return [String] the path of the file, if found.
|
@@ -67,8 +73,8 @@ module Splash
|
|
67
73
|
|
68
74
|
|
69
75
|
|
70
|
-
#
|
71
|
-
# @return [Bool]
|
76
|
+
# facility to verifyingif the active process run as root
|
77
|
+
# @return [Bool] status
|
72
78
|
def is_root?
|
73
79
|
case (Process.uid)
|
74
80
|
when 0
|
@@ -78,9 +84,9 @@ module Splash
|
|
78
84
|
end
|
79
85
|
end
|
80
86
|
|
81
|
-
#
|
87
|
+
# wrapping execution if process run as root
|
82
88
|
# @param [Symbol] method a method name th wrap
|
83
|
-
# @return [void]
|
89
|
+
# @return [void] return of wrapped method
|
84
90
|
def run_as_root(method, options = {})
|
85
91
|
unless is_root?
|
86
92
|
return {:case => :not_root, :more => "subcommands : #{method.to_s}"}
|
@@ -188,15 +194,15 @@ module Splash
|
|
188
194
|
return 0
|
189
195
|
end
|
190
196
|
|
191
|
-
# @!group
|
197
|
+
# @!group facilities for file system commands
|
192
198
|
|
193
|
-
#
|
199
|
+
# facility for file installation
|
194
200
|
# @param [Hash] options
|
195
|
-
# @option options [String] :source
|
196
|
-
# @option options [String] :target
|
197
|
-
# @option options [String] :mode
|
198
|
-
# @option options [String] :owner
|
199
|
-
# @option options [String] :group
|
201
|
+
# @option options [String] :source file source path
|
202
|
+
# @option options [String] :target file target path
|
203
|
+
# @option options [String] :mode String for OCTAL rights like "644"
|
204
|
+
# @option options [String] :owner file owner for target
|
205
|
+
# @option options [String] :group file group for target
|
200
206
|
def install_file(options = {})
|
201
207
|
#begin
|
202
208
|
FileUtils::copy options[:source], options[:target] #unless File::exist? options[:target]
|
@@ -208,12 +214,12 @@ module Splash
|
|
208
214
|
#end
|
209
215
|
end
|
210
216
|
|
211
|
-
#
|
217
|
+
# facility for folder creation
|
212
218
|
# @param [Hash] options
|
213
|
-
# @option options [String] :path
|
214
|
-
# @option options [String] :mode
|
215
|
-
# @option options [String] :owner
|
216
|
-
# @option options [String] :group
|
219
|
+
# @option options [String] :path folder path (relative or absolute)
|
220
|
+
# @option options [String] :mode String for OCTAL rights like "644"
|
221
|
+
# @option options [String] :owner file owner for folder
|
222
|
+
# @option options [String] :group file group for folder
|
217
223
|
def make_folder(options = {})
|
218
224
|
begin
|
219
225
|
FileUtils::mkdir_p options[:path] unless File::exist? options[:path]
|
@@ -225,10 +231,10 @@ module Splash
|
|
225
231
|
end
|
226
232
|
end
|
227
233
|
|
228
|
-
#
|
234
|
+
# facility for Symbolic link
|
229
235
|
# @param [Hash] options
|
230
|
-
# @option options [String] :source
|
231
|
-
# @option options [String] :link
|
236
|
+
# @option options [String] :source path of the file
|
237
|
+
# @option options [String] :link path of the symlink
|
232
238
|
def make_link(options = {})
|
233
239
|
begin
|
234
240
|
FileUtils::rm options[:link] if (File::symlink? options[:link] and not File::exist? options[:link])
|
@@ -241,15 +247,15 @@ module Splash
|
|
241
247
|
# @!endgroup
|
242
248
|
|
243
249
|
|
244
|
-
#@!group
|
250
|
+
#@!group Verifiers for application : FS and TCP/IP services
|
245
251
|
|
246
|
-
#
|
252
|
+
# check folder
|
247
253
|
# @return [Array] of Symbol with error type : [:inexistant,:mode,:owner,:group]
|
248
254
|
# @param [Hash] options
|
249
|
-
# @option options [String] :path
|
250
|
-
# @option options [String] :mode
|
251
|
-
# @option options [String] :owner owner
|
252
|
-
# @option options [String] :group
|
255
|
+
# @option options [String] :path folder path (relative or absolute)
|
256
|
+
# @option options [String] :mode String for OCTAL rights like "644", optionnal
|
257
|
+
# @option options [String] :owner file owner for folder, optionnal
|
258
|
+
# @option options [String] :group file group for folder, optionnal
|
253
259
|
def verify_folder(options ={})
|
254
260
|
res = Array::new
|
255
261
|
return [:inexistant] unless File.directory?(options[:name])
|
@@ -267,21 +273,21 @@ module Splash
|
|
267
273
|
return res
|
268
274
|
end
|
269
275
|
|
270
|
-
#
|
271
|
-
# @return [
|
276
|
+
# check symlink
|
277
|
+
# @return [Boolean]
|
272
278
|
# @param [Hash] options
|
273
|
-
# @option options [String] :name path
|
279
|
+
# @option options [String] :name path of the link
|
274
280
|
def verify_link(options ={})
|
275
281
|
return File.file?(options[:name])
|
276
282
|
end
|
277
283
|
|
278
|
-
#
|
284
|
+
# check file
|
279
285
|
# @return [Array] of Symbol with error type : [:inexistant,:mode,:owner,:group]
|
280
286
|
# @param [Hash] options
|
281
|
-
# @option options [String] :name path
|
282
|
-
# @option options [String] :mode
|
283
|
-
# @option options [String] :owner owner
|
284
|
-
# @option options [String] :group
|
287
|
+
# @option options [String] :name path of file
|
288
|
+
# @option options [String] :mode String for OCTAL rights like "644", optionnal
|
289
|
+
# @option options [String] :owner file owner for file, optionnal
|
290
|
+
# @option options [String] :group file group for file, optionnal
|
285
291
|
def verify_file(options ={})
|
286
292
|
res = Array::new
|
287
293
|
return [:inexistant] unless File.file?(options[:name])
|
@@ -299,11 +305,11 @@ module Splash
|
|
299
305
|
return res
|
300
306
|
end
|
301
307
|
|
302
|
-
#
|
303
|
-
# @return [Bool]
|
308
|
+
# TCP/IP service checker
|
309
|
+
# @return [Bool] status
|
304
310
|
# @param [Hash] options
|
305
|
-
# @option options [String] :host
|
306
|
-
# @option options [String] :port
|
311
|
+
# @option options [String] :host hostname
|
312
|
+
# @option options [String] :port TCP port
|
307
313
|
def verify_service(options ={})
|
308
314
|
begin
|
309
315
|
Timeout::timeout(1) do
|
@@ -322,6 +328,24 @@ module Splash
|
|
322
328
|
#!@endgroup
|
323
329
|
|
324
330
|
|
331
|
+
def format_response(data, format)
|
332
|
+
response = case format
|
333
|
+
when 'application/json' then JSON.pretty_generate(data)
|
334
|
+
when 'text/x-yaml' then data.to_yaml
|
335
|
+
else JSON.pretty_generate(data)
|
336
|
+
end
|
337
|
+
return response
|
338
|
+
end
|
339
|
+
|
340
|
+
def format_by_extensions(extension)
|
341
|
+
result = {
|
342
|
+
'json' => 'application/json',
|
343
|
+
'yaml' => 'text/x-yaml',
|
344
|
+
'yml' => 'text/x-yaml'
|
345
|
+
}
|
346
|
+
return result[extension]
|
347
|
+
end
|
348
|
+
|
325
349
|
|
326
350
|
end
|
327
351
|
end
|
data/lib/splash/loggers.rb
CHANGED
@@ -1,12 +1,20 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
# base Splash module
|
4
4
|
module Splash
|
5
|
+
|
6
|
+
# Loggers namespace
|
5
7
|
module Loggers
|
6
8
|
include Splash::Config
|
7
9
|
|
8
10
|
@@logger=nil
|
9
11
|
|
12
|
+
|
13
|
+
# factory for Loggers
|
14
|
+
# @param [Hash] options
|
15
|
+
# @option options [Symbol] :logger the name of the logger actually in [:cli, :daemon, :dual]
|
16
|
+
# @option options [Boolean] :force to force new instance creation (Logger is class variable)
|
17
|
+
# @return [SPlash::Loggers::<type>] type is Cli, Dual, Daemon, Web
|
10
18
|
def get_logger(options = {})
|
11
19
|
logger = (get_config.loggers[:list].include? options[:logger])? options[:logger].to_s : get_config.loggers[:default].to_s
|
12
20
|
aclass = "Splash::Loggers::#{logger.capitalize}"
|
@@ -18,11 +26,15 @@ module Splash
|
|
18
26
|
end
|
19
27
|
end
|
20
28
|
|
29
|
+
# build a session number
|
30
|
+
# @return [String] Session number
|
21
31
|
def get_session
|
22
32
|
return "#{Time.now.to_i.to_s}#{rand(999)}"
|
23
33
|
end
|
24
34
|
|
25
35
|
|
36
|
+
# wrapper to change logger, call get_logger with force: true
|
37
|
+
# @option options [Symbol] :logger the name of the logger actually in [:cli, :daemon, :dual]
|
26
38
|
def change_logger(options = {})
|
27
39
|
level = get_logger.level
|
28
40
|
options[:force] = true
|
@@ -31,9 +43,10 @@ module Splash
|
|
31
43
|
|
32
44
|
LEVELS = [:debug, :warn, :info, :result, :fatal, :unknown]
|
33
45
|
ALIAS = {:flat => :info, :item => :info, :ok => :info, :ko => :info, :trigger => :info,
|
34
|
-
:schedule => :info, :arrow => :info, :send => :info,
|
46
|
+
:schedule => :info, :arrow => :info, :send => :info, :call => :info,
|
35
47
|
:receive => :info, :error => :result, :success => :result }
|
36
48
|
|
49
|
+
# class template for loggers
|
37
50
|
class LoggerTemplate
|
38
51
|
include Splash::Config
|
39
52
|
|
@@ -48,13 +61,18 @@ module Splash
|
|
48
61
|
self.log({ :level => method, :message => message, :session => session})
|
49
62
|
end
|
50
63
|
end
|
64
|
+
|
65
|
+
# constructor
|
51
66
|
def initialize
|
52
67
|
self.level = get_config.loggers[:level]
|
53
68
|
|
54
69
|
|
55
70
|
end
|
56
71
|
|
57
|
-
|
72
|
+
# abstract method for log wrapper
|
73
|
+
# @param [Hash] options
|
74
|
+
# @option options [Symbol] :level, a valid level in LEVELS or ALIAS
|
75
|
+
# @option options [String] :message text
|
58
76
|
def log(options)
|
59
77
|
level = (ALIAS.keys.include? options[:level])? ALIAS[options[:level]] : options[:level]
|
60
78
|
if @active_levels.include? level then
|
@@ -62,11 +80,15 @@ module Splash
|
|
62
80
|
end
|
63
81
|
end
|
64
82
|
|
65
|
-
|
83
|
+
# getter for the current level
|
84
|
+
# @return [Symbol] level
|
66
85
|
def level
|
67
86
|
return @active_levels.first
|
68
87
|
end
|
69
88
|
|
89
|
+
# virtual setter for level, set the current level
|
90
|
+
# @raise a badLevel in case of bad level
|
91
|
+
# @param [Symbol] level
|
70
92
|
def level=(level)
|
71
93
|
if LEVELS.include? level then
|
72
94
|
@active_levels = LEVELS.dup
|
@@ -78,6 +100,9 @@ module Splash
|
|
78
100
|
|
79
101
|
|
80
102
|
private
|
103
|
+
# mapper for symbol Symbol to String
|
104
|
+
# @param [Symbol] symbol
|
105
|
+
# @return [String] in upcase, exception :arrow give '=>', :flat give ''
|
81
106
|
def alt(symbol)
|
82
107
|
return "=>" if symbol == :arrow
|
83
108
|
return '' if symbol == :flat
|
@@ -86,6 +111,7 @@ module Splash
|
|
86
111
|
|
87
112
|
end
|
88
113
|
|
114
|
+
# badLevel Exception
|
89
115
|
class BadLevel < Exception; end
|
90
116
|
|
91
117
|
end
|
data/lib/splash/loggers/cli.rb
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
|
3
|
+
# base Splash module
|
2
4
|
module Splash
|
5
|
+
|
6
|
+
# Splash Loggers module
|
3
7
|
module Loggers
|
4
8
|
|
9
|
+
# Cli specific logger
|
5
10
|
class Cli < Splash::Loggers::LoggerTemplate
|
6
11
|
|
7
12
|
include Splash::Config
|
8
13
|
|
14
|
+
# mapping of UTf-8 emoji for log levels or alias
|
9
15
|
EMOJI = { :unknown => "\u{1F4A5}",
|
10
16
|
:fatal => "\u{26D4}",
|
11
17
|
:error => "\u{1F6AB}",
|
@@ -22,6 +28,7 @@ module Splash
|
|
22
28
|
:success => "\u{1F4AA}",
|
23
29
|
:debug => "\u{1F41B}"}
|
24
30
|
|
31
|
+
# mapping of colors for log levels or alias
|
25
32
|
COLORS = { :unknown => :red,
|
26
33
|
:fatal => :red,
|
27
34
|
:error => :red,
|
@@ -39,7 +46,11 @@ module Splash
|
|
39
46
|
:debug => :magenta}
|
40
47
|
|
41
48
|
|
42
|
-
|
49
|
+
# log wrapper
|
50
|
+
# @param [Hash] options
|
51
|
+
# @option options [Symbol] :level defined in Splash::Loggers::LEVEL or Splash::Loggers::ALIAS
|
52
|
+
# @option options [String] :message
|
53
|
+
# display formatted string to STDOUT
|
43
54
|
def log(options)
|
44
55
|
level = (ALIAS.keys.include? options[:level])? ALIAS[options[:level]] : options[:level]
|
45
56
|
if @active_levels.include? level then
|
@@ -59,14 +70,20 @@ module Splash
|
|
59
70
|
end
|
60
71
|
end
|
61
72
|
|
73
|
+
# setter in configuration for emoji display
|
74
|
+
# @param [Boolean] status
|
62
75
|
def emoji=(status)
|
63
76
|
get_config.loggers[:cli][:emoji] = status
|
64
77
|
end
|
65
78
|
|
79
|
+
# setter in configuration for color display
|
80
|
+
# @param [Boolean] status
|
66
81
|
def color=(status)
|
67
82
|
get_config.loggers[:cli][:color] = status
|
68
83
|
end
|
69
84
|
|
85
|
+
# check if unicode must be used with term ENV
|
86
|
+
# @return [Boolean]
|
70
87
|
def check_unicode_term
|
71
88
|
return false unless ENV.include? "TERM"
|
72
89
|
if ENV.values_at("LC_ALL","LC_CTYPE","LANG").compact.first.include?("UTF-8") and ENV.values_at('TERM').first.include? "xterm" then
|
@@ -78,7 +95,5 @@ module Splash
|
|
78
95
|
|
79
96
|
end
|
80
97
|
|
81
|
-
class BadLevel < Exception; end
|
82
|
-
|
83
98
|
end
|
84
99
|
end
|
@@ -1,12 +1,17 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
|
3
|
+
# base Splash module
|
2
4
|
module Splash
|
3
|
-
module Loggers
|
4
5
|
|
6
|
+
# Splash Loggers module
|
7
|
+
module Loggers
|
5
8
|
|
9
|
+
# Daemon specific logger
|
6
10
|
class Daemon < Splash::Loggers::LoggerTemplate
|
7
11
|
|
8
12
|
|
9
|
-
|
13
|
+
# contructor, open log file
|
14
|
+
# @return [Splash::Loggers::Daemon]
|
10
15
|
def initialize
|
11
16
|
self.level = get_config.loggers[:level]
|
12
17
|
@log_file = get_config.loggers[:daemon][:file]
|
@@ -14,7 +19,12 @@ module Splash
|
|
14
19
|
@stream.sync = true
|
15
20
|
end
|
16
21
|
|
17
|
-
|
22
|
+
# log wrapper
|
23
|
+
# @param [Hash] options
|
24
|
+
# @option options [Symbol] :level defined in Splash::Loggers::LEVEL or Splash::Loggers::ALIAS
|
25
|
+
# @option options [String] :message
|
26
|
+
# @option options [String] :session a session number
|
27
|
+
# write formatted string to log file
|
18
28
|
def log(options)
|
19
29
|
pid = Process.pid.to_s
|
20
30
|
date = DateTime.now.to_s
|
@@ -28,6 +38,7 @@ module Splash
|
|
28
38
|
end
|
29
39
|
end
|
30
40
|
|
41
|
+
# close log file descriptor
|
31
42
|
def close
|
32
43
|
@stream.close
|
33
44
|
end
|