onering-client 0.3.4 → 0.4.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/lib/onering.rb +1 -1
- data/lib/onering/api.rb +1 -1
- data/lib/onering/logger.rb +12 -3
- data/lib/onering/util.rb +10 -6
- metadata +1 -1
data/lib/onering.rb
CHANGED
data/lib/onering/api.rb
CHANGED
data/lib/onering/logger.rb
CHANGED
@@ -29,10 +29,15 @@ module Onering
|
|
29
29
|
when :warn then sevtag = 'WW'
|
30
30
|
when :info then sevtag = 'II'
|
31
31
|
when :debug then sevtag = 'DD'
|
32
|
+
when :output then sevtag = ''
|
32
33
|
else sevtag = '??'
|
33
34
|
end
|
34
35
|
|
35
|
-
|
36
|
+
if options[:sevtag] == false
|
37
|
+
logline = [(source.nil? ? nil : "[#{source}]"), msg].compact.join(' ')
|
38
|
+
else
|
39
|
+
logline = ["#{sevtag} ", (source.nil? ? nil : "[#{source}]"), msg].compact.join(' ')
|
40
|
+
end
|
36
41
|
|
37
42
|
if options[:destination] === STDOUT or options[:destination] === STDERR
|
38
43
|
case severity.downcase.to_sym
|
@@ -50,10 +55,10 @@ module Onering
|
|
50
55
|
options[:destination].puts(logline)
|
51
56
|
})
|
52
57
|
|
53
|
-
self.level = options[:threshold]
|
58
|
+
self.level = (options[:threshold] || :info)
|
54
59
|
|
55
60
|
self.debug("onering-client v#{Onering::Client::VERSION} started")
|
56
|
-
self.debug("Logger is initialized. Output is #{outputfn}, threshold: #{options[:threshold]} or worse", "Onering::Logger")
|
61
|
+
self.debug("Logger is initialized. Output is #{outputfn || 'stderr'}, threshold: #{options[:threshold]} or worse", "Onering::Logger")
|
57
62
|
end
|
58
63
|
|
59
64
|
|
@@ -113,6 +118,10 @@ module Onering
|
|
113
118
|
self.log(:debug, message, source, 3)
|
114
119
|
end
|
115
120
|
|
121
|
+
def self.output(message, source=nil)
|
122
|
+
self.log(:output, message, source)
|
123
|
+
end
|
124
|
+
|
116
125
|
def self._get_level(severity)
|
117
126
|
case severity.to_sym
|
118
127
|
when :fatal
|
data/lib/onering/util.rb
CHANGED
@@ -78,12 +78,16 @@ module Onering
|
|
78
78
|
}
|
79
79
|
|
80
80
|
def gem_path(name)
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
81
|
+
begin
|
82
|
+
if Gem::Specification.respond_to?(:find_by_name)
|
83
|
+
return Gem::Specification.find_by_name(name).gem_dir
|
84
|
+
else
|
85
|
+
return Gem::SourceIndex.from_installed_gems.find_name(name).sort{|a,b|
|
86
|
+
a.version.to_s <=> b.version.to_s
|
87
|
+
}.last.full_gem_path
|
88
|
+
end
|
89
|
+
rescue Gem::LoadError
|
90
|
+
return nil
|
87
91
|
end
|
88
92
|
end
|
89
93
|
|