Module: DebugMixin
- Defined in:
- lib/conjur/debify.rb
Overview
This is used to turn on DEBUG notices.
Constant Summary collapse
- DEBUG =
ENV['DEBUG'].nil? ? true : ENV['DEBUG'].downcase == 'true'
- DOCKER =
method :docker_debug
Class Method Summary collapse
- .debug(*a) ⇒ Object
- .debug_write(*a) ⇒ Object
-
.docker_debug(*a) ⇒ Object
you can give this to various docker methods to print output if debug is on.
Instance Method Summary collapse
Class Method Details
.debug(*a) ⇒ Object
36 37 38 |
# File 'lib/conjur/debify.rb', line 36 def self.debug *a $stderr.puts *a if DEBUG end |
.debug_write(*a) ⇒ Object
44 45 46 |
# File 'lib/conjur/debify.rb', line 44 def self.debug_write *a $stderr.write *a if DEBUG end |
.docker_debug(*a) ⇒ Object
you can give this to various docker methods to print output if debug is on
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/conjur/debify.rb', line 49 def self.docker_debug *a if a.length == 2 && a[0].is_a?(Symbol) debug a.last else a.each do |line| begin line = JSON.parse(line) line.keys.each do |k| debug line[k] end rescue JSON::ParserError # Docker For Mac is spitting out invalid JSON, so just print # out the line if parsing fails. debug line end end end end |
Instance Method Details
#debug(*a) ⇒ Object
32 33 34 |
# File 'lib/conjur/debify.rb', line 32 def debug *a DebugMixin.debug *a end |
#debug_write(*a) ⇒ Object
40 41 42 |
# File 'lib/conjur/debify.rb', line 40 def debug_write *a DebugMixin.debug_write *a end |