logspot 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -7
- data/README.md +5 -0
- data/lib/lo_gspot/output/file.rb +11 -5
- data/lib/logspot.rb +2 -2
- data/logspot.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6595774b426267654aafd83076d8e173ca7b320d
|
4
|
+
data.tar.gz: 25d9c409f6bf3db7a88860332a77620f8994c501
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d9fd46216eda1d1ed768d84fd79dba9709d608691f35468ad66f7818042590cce959e550b6f48b5afa704882da4d55f09126e422281ef1a7a892493fc69f27e
|
7
|
+
data.tar.gz: 55cb548f9c70e5562ffb9974b7f105b98be5da1af1da1129d52e738973cbd00a03b665e58137417799e4a38efb8b8f6d40fb6d08f1f0f2db129594774794b81d
|
data/Gemfile.lock
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
logspot (0.
|
4
|
+
logspot (0.4.0)
|
5
5
|
activesupport (>= 4)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (4.
|
11
|
-
i18n (~> 0.
|
10
|
+
activesupport (4.2.0)
|
11
|
+
i18n (~> 0.7)
|
12
12
|
json (~> 1.7, >= 1.7.7)
|
13
13
|
minitest (~> 5.1)
|
14
|
-
thread_safe (~> 0.
|
14
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
15
15
|
tzinfo (~> 1.1)
|
16
16
|
diff-lcs (1.2.5)
|
17
|
-
i18n (0.
|
18
|
-
json (1.8.
|
19
|
-
minitest (5.
|
17
|
+
i18n (0.7.0)
|
18
|
+
json (1.8.2)
|
19
|
+
minitest (5.5.1)
|
20
20
|
rspec (3.1.0)
|
21
21
|
rspec-core (~> 3.1.0)
|
22
22
|
rspec-expectations (~> 3.1.0)
|
data/README.md
CHANGED
data/lib/lo_gspot/output/file.rb
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
class LoGspot::Output::File
|
2
|
-
def initialize(
|
3
|
-
|
4
|
-
|
2
|
+
def initialize(arg)
|
3
|
+
if arg.is_a?(String)
|
4
|
+
@physical = true
|
5
|
+
FileUtils.mkdir_p(File.dirname(arg))
|
6
|
+
@file = File.open(arg, 'a')
|
7
|
+
else
|
8
|
+
@physical = false
|
9
|
+
@file = arg
|
10
|
+
end
|
5
11
|
end
|
6
12
|
|
7
13
|
def puts(data)
|
@@ -10,10 +16,10 @@ class LoGspot::Output::File
|
|
10
16
|
end
|
11
17
|
|
12
18
|
def finalize
|
13
|
-
|
19
|
+
file.close if physical
|
14
20
|
end
|
15
21
|
|
16
22
|
private
|
17
23
|
|
18
|
-
attr_reader :file
|
24
|
+
attr_reader :file, :physical
|
19
25
|
end
|
data/lib/logspot.rb
CHANGED
@@ -3,7 +3,7 @@ require_relative 'initialize'
|
|
3
3
|
class LoGspot
|
4
4
|
LOG_LEVELS = %w(DEBUG INFO WARN ERROR FATAL)
|
5
5
|
|
6
|
-
def initialize(
|
6
|
+
def initialize(file_or_file_name = STDOUT, wrapper = nil)
|
7
7
|
wrapper = ->(output, data) {
|
8
8
|
base = "[#{Time.now.strftime('%Y/%m/%d %H:%M:%S')} #{level}] "
|
9
9
|
if data[:space]
|
@@ -11,7 +11,7 @@ class LoGspot
|
|
11
11
|
end
|
12
12
|
output.puts(message: "#{base}#{data[:message]}")
|
13
13
|
}
|
14
|
-
@file = Output::File.new(
|
14
|
+
@file = Output::File.new(file_or_file_name)
|
15
15
|
@output = @original_output = Output::Wrap.new(wrapper, @file)
|
16
16
|
@level = nil
|
17
17
|
end
|
data/logspot.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logspot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tetsuri Moriya
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|