ztk 1.13.0 → 1.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTRhNmY2NDM2MmYxMTliNjI0ZGJlMTQyYjRjY2Y0NTkwZjQ5NDY0NQ==
4
+ NGVjMmUxNzUxNjk2NGUxY2FkYTYyMWU5YWM0ODZmYzUzYTViYTZlNg==
5
5
  data.tar.gz: !binary |-
6
- NzJlZmE0ZDc1Njc5M2UyN2E2OTA2YTlhMjY4MDc1MmMyYjliNDljMg==
6
+ Zjc5OTRiOWM2ZWYxZDJiMDdjZjc3ZDU5NzcyMmE5ZDQ3Y2JlZDVkMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YWRmZDY2Y2NjODU1ZmQ2YmM5NzhlOGJmYzZmNmE1YjQxNzZkN2JlYWZjODcx
10
- ZjcyMjBjYTNiNjY3MTk1OWE4MmE2NDY2YjY4ZGQ3MzEyODM3MWRiMzcwNzVh
11
- YTI3MzUzOGNiNmI5ZjJhOTI1ZjBjZmRmMTY0MmM2YWQ2YmQ3ZWU=
9
+ ZDZlZGMyYmI0M2U4Zjc2YTA5ZjNlMzZkNDEzODhmY2NiNDQ5MzIzMTg0OGJk
10
+ YTEyZWI2ZmI0OTYzMjdjMWQ2Yzk1ODAxOWJmZGE4NGRmYzViOGM3M2I3ZTMw
11
+ MjA4ZTUwOTk1NThmNmQ3ZjA5MmJkMDVlNTNmYTRhMTU2NWM1OGM=
12
12
  data.tar.gz: !binary |-
13
- NTE4YjU4ODcwNzhkMzg0OTg3OWUxYzYwYTYxMWVjYjU5MjU4NTE1ZjZiNmRi
14
- MmZiNTJlZDEwNWJmYzg2NTY1MzZhZDlkNjQwMTljZmU1MWM0ZmE2YjA4MjRh
15
- ZTBlNjMxMWUwNzY4NzA4ODk0YTRmNTNkNjAwODQ0ZWI3NjYyZjY=
13
+ OTJmMGY5NGIyMjgyZGUwMGE4MjUyMmMyMDljY2RlYThjMjc5NGViYTNmZTQx
14
+ MDNkNWU0MThhZjJiZjBhMGY2MzI3NGUwNjY0YWIxZjYxNDUzNTU5ZGUzY2Rm
15
+ YTZlNjdmN2FiN2RjNzQ2OTRhOTIyNDAzYmYyYjA4YmY0ZWE2Zjk=
@@ -24,6 +24,7 @@ module ZTK
24
24
  #
25
25
  # @author Zachary Patten <zachary AT jovelabs DOT com>
26
26
  class Logger < ::Logger
27
+ attr_accessor :stdout_echo
27
28
 
28
29
  # Log Levels
29
30
  SEVERITIES = Severity.constants.inject([]) {|arr,c| arr[Severity.const_get(c)] = c; arr}
@@ -95,7 +96,9 @@ module ZTK
95
96
  message = [message, progname].flatten.compact.join(": ")
96
97
  message = "%19s.%06d|%05d|%5s|%s%s\n" % [Time.now.utc.strftime("%Y-%m-%d|%H:%M:%S"), Time.now.utc.usec, Process.pid, SEVERITIES[severity], called_by, message]
97
98
 
98
- @logdev.write(ZTK::ANSI.uncolor(message))
99
+ statement = ZTK::ANSI.uncolor(message)
100
+ stdout_echo.nil? or $stdout.write(statement)
101
+ @logdev.write(statement)
99
102
  @logdev.respond_to?(:flush) and @logdev.flush
100
103
 
101
104
  true
@@ -1,6 +1,6 @@
1
1
  module ZTK
2
2
 
3
3
  # ZTK Version String
4
- VERSION = "1.13.0"
4
+ VERSION = "1.14.0"
5
5
 
6
6
  end
@@ -89,6 +89,19 @@ describe ZTK::Logger do
89
89
  IO.read(@logfile).match(data).should_not be nil
90
90
  end
91
91
 
92
+ it "should allow us to echo log statements to STDOUT" do
93
+ data = "Hello World"
94
+ stdout = StringIO.new
95
+
96
+ $stdout = stdout
97
+
98
+ subject.stdout_echo = true
99
+ subject.debug { data }
100
+
101
+ stdout.rewind
102
+ stdout.read.match(data).should_not be nil
103
+ end
104
+
92
105
  end
93
106
 
94
107
  describe "log message" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ztk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Patten