Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Clear progress lines when printing severity messages

  • Loading branch information...
commit cdaababa5da0b24a868abf95d9e28613210d09ad 1 parent 60ff55b
@lsegal authored
Showing with 10 additions and 3 deletions.
  1. +10 −3 lib/yard/logging.rb
View
13 lib/yard/logging.rb
@@ -105,7 +105,7 @@ def progress(msg, nontty_log = :debug)
# @since 0.8.2
def clear_progress
return unless show_progress
- clear_line
+ print_no_newline("\e[?25h\e[2K")
@progress_msg = nil
end
@@ -126,7 +126,7 @@ def puts(msg = '')
# @return [void]
# @since 0.8.2
def print(msg = '')
- clear_line if @progress_msg
+ clear_line
print_no_newline(msg)
end
alias_method :<<, :print
@@ -169,8 +169,15 @@ def enter_level(new_level = level, &block)
private
+ # Override this internal Logger method to clear line
+ def add(*args)
+ clear_line
+ super(*args)
+ end
+
def clear_line
- print_no_newline("\e[?25h\e[2K")
+ return unless @progress_msg
+ print_no_newline("\e[2K\r")
end
# Log format (from Logger implementation). Used by Logger internally
Please sign in to comment.
Something went wrong with that request. Please try again.