datalogger 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/datalogger/logger.rb +1 -1
- data/lib/datalogger/sinks/stdout.rb +17 -0
- data/lib/datalogger/version.rb +1 -1
- data/lib/datalogger.rb +1 -1
- metadata +2 -2
- data/lib/datalogger/stdout_sink.rb +0 -15
data/lib/datalogger/logger.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
module DataLogger
|
2
|
+
module Sinks
|
3
|
+
class STDOUT
|
4
|
+
def initialize(sync=true)
|
5
|
+
::STDOUT.sync = sync
|
6
|
+
end
|
7
|
+
|
8
|
+
def stringify_data(data)
|
9
|
+
data.inject("") { |s, (k,v)| s + "#{k}=#{v} " }.strip
|
10
|
+
end
|
11
|
+
|
12
|
+
def log(component, data)
|
13
|
+
puts "#{component} #{stringify_data(data)}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/datalogger/version.rb
CHANGED
data/lib/datalogger.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datalogger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -25,7 +25,7 @@ files:
|
|
25
25
|
- datalogger.gemspec
|
26
26
|
- lib/datalogger.rb
|
27
27
|
- lib/datalogger/logger.rb
|
28
|
-
- lib/datalogger/
|
28
|
+
- lib/datalogger/sinks/stdout.rb
|
29
29
|
- lib/datalogger/version.rb
|
30
30
|
- spec/logger_spec.rb
|
31
31
|
- spec/stdout_sink_spec.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module DataLogger
|
2
|
-
class STDOUTSink
|
3
|
-
def initialize(sync=true)
|
4
|
-
STDOUT.sync = sync
|
5
|
-
end
|
6
|
-
|
7
|
-
def stringify_data(data)
|
8
|
-
data.inject("") { |s, (k,v)| s + "#{k}=#{v} " }.strip
|
9
|
-
end
|
10
|
-
|
11
|
-
def log(component, data)
|
12
|
-
puts "#{component} #{stringify_data(data)}"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|