runit-man 2.0.2 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/runit-man/app.rb +3 -6
- data/lib/runit-man/log_location_cache.rb +4 -2
- data/lib/runit-man/service_info.rb +11 -4
- data/lib/runit-man/version.rb +1 -1
- metadata +4 -4
data/lib/runit-man/app.rb
CHANGED
@@ -20,8 +20,9 @@ class RunitMan < Sinatra::Base
|
|
20
20
|
:js => 'application/x-javascript',
|
21
21
|
:json => 'application/json'
|
22
22
|
}.freeze
|
23
|
+
DEFAULT_LOGGER = 'svlogd'.freeze
|
23
24
|
|
24
|
-
set :logger_option,
|
25
|
+
set :logger_option, DEFAULT_LOGGER
|
25
26
|
set :environment, :production
|
26
27
|
set :static, true
|
27
28
|
set :logging, true
|
@@ -239,16 +240,12 @@ class RunitMan < Sinatra::Base
|
|
239
240
|
@files_to_view ||= []
|
240
241
|
end
|
241
242
|
|
242
|
-
def logger
|
243
|
-
'svlogd'
|
244
|
-
end
|
245
|
-
|
246
243
|
def allowed_users
|
247
244
|
@allowed_users ||= {}
|
248
245
|
end
|
249
246
|
|
250
247
|
def logger
|
251
|
-
settings.logger_option ||
|
248
|
+
settings.logger_option || DEFAULT_LOGGER
|
252
249
|
end
|
253
250
|
|
254
251
|
def prepare_to_run
|
@@ -43,8 +43,10 @@ private
|
|
43
43
|
def get_pid_location(lpid)
|
44
44
|
folder = log_folder(lpid)
|
45
45
|
return nil if folder.nil?
|
46
|
-
return File.join(folder, 'current') if logger ==
|
47
|
-
File.join(folder, Time.now.strftime('%Y-%m-%d'), "#{log_folder_base_name(lpid)}.log")
|
46
|
+
return File.join(folder, 'current') if logger == RunitMan::DEFAULT_LOGGER
|
47
|
+
loc = File.join(folder, Time.now.strftime('%Y-%m-%d'), "#{log_folder_base_name(lpid)}.log")
|
48
|
+
loc = "#{loc}.gz" unless File.exists?(loc)
|
49
|
+
loc
|
48
50
|
end
|
49
51
|
|
50
52
|
def log_command(lpid)
|
@@ -113,12 +113,14 @@ class ServiceInfo
|
|
113
113
|
|
114
114
|
def logger_log_file_path(file_name)
|
115
115
|
dir_name = File.dirname(File.dirname(log_file_location))
|
116
|
-
File.expand_path(File.join(file_name, "#{name}.log"), dir_name)
|
116
|
+
loc = File.expand_path(File.join(file_name, "#{name}.log"), dir_name)
|
117
|
+
loc = "#{loc}.gz" unless File.exists?(loc)
|
118
|
+
loc
|
117
119
|
end
|
118
120
|
|
119
121
|
def log_file_path(file_name)
|
120
122
|
case RunitMan.logger
|
121
|
-
when
|
123
|
+
when RunitMan::DEFAULT_LOGGER then svlogd_log_file_path(file_name)
|
122
124
|
when /^logger(?:\:.+)?/ then logger_log_file_path(file_name)
|
123
125
|
else nil
|
124
126
|
end
|
@@ -156,8 +158,13 @@ class ServiceInfo
|
|
156
158
|
full_name = File.expand_path(name, dir_name)
|
157
159
|
next unless File.directory?(full_name)
|
158
160
|
file_name = File.join(full_name, "#{self.name}.log")
|
159
|
-
stats = File.stat(file_name)
|
160
161
|
label = "#{Utils.host_name}-#{self.name}-#{name}.log"
|
162
|
+
unless File.exists?(file_name)
|
163
|
+
file_name = "#{file_name}.gz"
|
164
|
+
label = "#{label}.gz"
|
165
|
+
end
|
166
|
+
stats = File.stat(file_name)
|
167
|
+
|
161
168
|
r << {
|
162
169
|
:name => name,
|
163
170
|
:label => label,
|
@@ -174,7 +181,7 @@ class ServiceInfo
|
|
174
181
|
|
175
182
|
def log_files
|
176
183
|
case RunitMan.logger
|
177
|
-
when
|
184
|
+
when RunitMan::DEFAULT_LOGGER then svlogd_log_files
|
178
185
|
when /^logger(?:\:.+)?/ then logger_log_files
|
179
186
|
else []
|
180
187
|
end
|
data/lib/runit-man/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: runit-man
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 2.0.
|
9
|
+
- 6
|
10
|
+
version: 2.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Akzhan Abdulin
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-07 00:00:00 +04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|