Class | YARD::Logger
In: | lib/yard/logging.rb
Parent: | ::Logger

Handles console logging for info, warnings and errors. Uses the stdlib Logger class in Ruby for all the backend logic.

### Methods

backtrace capture clear_progress debug enter_level instance new progress puts show_backtraces show_progress warn_no_continuations

### Constants

PROGRESS_INDICATORS | = | ["\u230C", "\u230D", "\u230E", "\u230F"] |  | The list of characters displayed beside the progress bar to indicate "movement". @since 0.8.2

### Attributes

io | [RW] | @return [IO] the IO object being logged to @since 0.8.2
show_backtraces | [W] |
show_progress | [W] |

### Public Class methods

instance(pipe = STDOUT)

The logger instance @return [Logger] the logger instance

new(pipe, *args)

Creates a new logger

### Public Instance methods

backtrace(exc, level_meth = :error)

Prints the backtrace `exc` to the logger as error data.

@param [Array<String>] exc the backtrace list @param [Symbol] level_meth the level to log backtrace at @return [void]

capture(msg, nontty_log = :debug) {|| ...}

Captures the duration of a block of code for benchmark analysis. Also calls {progress} on the message to display it to the user.

@todo Implement capture storage for reporting of benchmarks @param [String] msg the message to display @param [Symbol, nil] nontty_log the level to log as if the output

      stream is not a TTY. Use +nil+ for no alternate logging.

@yield a block of arbitrary code to benchmark @return [void]

clear_progress()

Clears the progress indicator in the TTY display. @return [void] @since 0.8.2

debug(*args)

Changes the debug level to DEBUG if $DEBUG is set and writes a debugging message.

enter_level(new_level = level) {|| ...}

Sets the logger level for the duration of the block

@example

      log.enter_level(Logger::ERROR) do
        YARD.parse_string "def x; end"
      end

@param [Fixnum] new_level the logger level for the duration of the block.

      values can be found in Ruby's Logger class.

@yield the block with the logger temporarily set to `new_level`

progress(msg, nontty_log = :debug)

Displays a progress indicator for a given message. This progress report is only displayed on TTY displays, otherwise the message is passed to the `nontty_log` level.

@param [String] msg the message to log @param [Symbol, nil] nontty_log the level to log as if the output

      stream is not a TTY. Use +nil+ for no alternate logging.

@return [void] @since 0.8.2

puts(msg)

Displays an unformatted line to the logger output stream. Similar to the +#<<+ method, but adds a newline. @param [String] msg the message to display @return [void] @since 0.8.2

show_backtraces()

@return [Boolean] whether backtraces should be shown (by default

      this is on).

show_progress()

@return [Boolean] whether progress indicators should be shown when

      logging CLIs (by default this is off).

warn_no_continuations()

Warns that the Ruby environment does not support continuations. Applies to JRuby, Rubinius and MacRuby. This warning will only display once per Ruby process.

@deprecated Continuations are no longer needed by YARD 0.8.0+. @return [void]

[Validate]