tiny_log 1.0.1 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tiny_log.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85cff9236f798df629886d40366c8a673ea208af89d7b37bea42038ea228e030
|
4
|
+
data.tar.gz: bf24cddc2ebf348ac713c0a066731fb1b2ce296db588eb77388ac920899c6a79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a77fd0f56106ddedd77e036643cfeff75d3c5a36d7034255e8b766ecd419ece90e7611ef183606e43c2fd8ddd2b5eabd1122d8706ac52057543ef9d4729526c
|
7
|
+
data.tar.gz: 2be85ce2aa21c78ecf995b7853937ad1517b0468ff4c3b450b0fa9c1d3dd5ad0cc1efe8a86afadba97848c5f186bf4ceadc7e5ef4baa5aacc77c15616652b6a8
|
data/lib/tiny_log.rb
CHANGED
@@ -17,14 +17,14 @@ class TinyLog
|
|
17
17
|
# if unspecified, will default to $stdout
|
18
18
|
# if specified, attempts to open a file with the specified name to append to
|
19
19
|
def initialize(filename=nil)
|
20
|
-
@io = filename ? File.open(filename, 'a') : $stdout
|
20
|
+
@io = filename.is_a?(String) ? File.open(filename, 'a') : $stdout
|
21
21
|
end
|
22
22
|
|
23
23
|
# the clever bit that annotates the log message with a log level and UTC
|
24
24
|
# timestamp
|
25
25
|
def method_missing(prefix, *msgs)
|
26
26
|
msgs.each do |m|
|
27
|
-
m.lines.each do |l|
|
27
|
+
m.to_s.lines.each do |l|
|
28
28
|
@io.puts "#{Time.now.utc.iso8601(6)} #{Process.pid.to_s.rjust(6)} #{prefix.to_s.upcase} #{l}"
|
29
29
|
end
|
30
30
|
end
|