Class: Tomo::Logger
- Inherits:
-
Object
- Object
- Tomo::Logger
- Extended by:
- Forwardable
- Includes:
- Colors
- Defined in:
- lib/tomo/logger.rb,
lib/tomo/logger/tagged_io.rb
Defined Under Namespace
Classes: TaggedIO
Instance Method Summary collapse
- #connect(host) ⇒ Object
- #debug(message) ⇒ Object
- #error(message) ⇒ Object
- #info(message) ⇒ Object
-
#initialize(stdout: $stdout, stderr: $stderr) ⇒ Logger
constructor
A new instance of Logger.
- #script_end(script, result) ⇒ Object
- #script_output(script, output) ⇒ Object
- #script_start(script) ⇒ Object
- #task_start(task) ⇒ Object
- #warn(message) ⇒ Object
Methods included from Colors
Constructor Details
Instance Method Details
#connect(host) ⇒ Object
39 40 41 42 43 |
# File 'lib/tomo/logger.rb', line 39 def connect(host) return if Tomo.quiet? puts gray("→ Connecting to #{host}") end |
#debug(message) ⇒ Object
65 66 67 68 69 |
# File 'lib/tomo/logger.rb', line 65 def debug() return unless Tomo.debug? stderr.puts gray("DEBUG: #{}") end |
#error(message) ⇒ Object
57 58 59 |
# File 'lib/tomo/logger.rb', line 57 def error() stderr.puts indent("\n" + red("ERROR: ") + .strip + "\n\n") end |
#info(message) ⇒ Object
51 52 53 54 55 |
# File 'lib/tomo/logger.rb', line 51 def info() return if Tomo.quiet? puts end |
#script_end(script, result) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/tomo/logger.rb', line 30 def script_end(script, result) return if Tomo.quiet? return unless result.failure? return unless script.silent? return unless script.raise_on_error? puts result.output end |
#script_output(script, output) ⇒ Object
24 25 26 27 28 |
# File 'lib/tomo/logger.rb', line 24 def script_output(script, output) return if script.silent? puts output end |
#script_start(script) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/tomo/logger.rb', line 17 def script_start(script) return if Tomo.quiet? return unless script.echo? puts yellow(script.echo_string) end |
#task_start(task) ⇒ Object
45 46 47 48 49 |
# File 'lib/tomo/logger.rb', line 45 def task_start(task) return if Tomo.quiet? puts blue("• #{task}") end |
#warn(message) ⇒ Object
61 62 63 |
# File 'lib/tomo/logger.rb', line 61 def warn() stderr.puts red("WARNING: ") + end |