class Bauxite::Loggers::XtermLogger

XTerm logger.

This logger outputs colorized lines using xterm (VT100/2) escape sequences.

XTerm logger options include:

nc, color

If set to 'no', prints text without using colors. Note that positional escape sequences will still be used to show progress. To disable escape sequences completely, consider using the Bauxite::Loggers::TerminalLogger logger instead.

Protected Instance Methods

_fmt(color, text, size = 0) click to toggle source
Calls superclass method Bauxite::Loggers::TerminalLogger#_fmt
# File lib/bauxite/loggers/xterm.rb, line 60
def _fmt(color, text, size = 0)
        text = super(color, text, size)
        if @options[:nc] or @options[:color] == 'no'
                text
        else
                "\033[#{COLORS[color]}m#{text}\033[0m"
        end
end
_restore_cursor() click to toggle source
# File lib/bauxite/loggers/xterm.rb, line 74
def _restore_cursor
        print "\033[u"
        true
end
_save_cursor() click to toggle source
# File lib/bauxite/loggers/xterm.rb, line 69
def _save_cursor
        print "\033[s"
        true
end
_screen_width() click to toggle source
Calls superclass method Bauxite::Loggers::TerminalLogger#_screen_width
# File lib/bauxite/loggers/xterm.rb, line 84
def _screen_width
        if RbConfig::CONFIG['host_os'] =~
/(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i
                (_dynamic_width_stty.nonzero? || _dynamic_width_tput)
        else
                super
        end
rescue Exception => e
        super
end