Sha256: 8712d04b8dd818ddf44438135ae63c4ae353f8b2de514db44c473165d27cd1c5
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
module Timber module LogDevices class IO < LogDevice class Formatter # Do not change this, the API matches on it. Otherwise nothing # get parsed. CALLOUT = "@timber.io " CALLOUT_END = "@original " # Embed in a String to clear all previous ANSI sequences. CLEAR = "\e[0m" BOLD = "\e[1m" # Colors BLACK = "\e[30m" DARK_GRAY = "\e[1;30m" RED = "\e[31m" GREEN = "\e[32m" YELLOW = "\e[33m" BLUE = "\e[34m" MAGENTA = "\e[35m" CYAN = "\e[36m" WHITE = "\e[37m" def initialize(options = {}) @ansi_format = options.key?(:ansi_format) ? options[:ansi_format] == true : true end def ansi_format? @ansi_format == true end def format(_log_line) raise NotImplementedError.new("#format is not implemented") end private def ansi_format(*args) text = args.pop return text unless ansi_format? "#{args.join}#{text}#{CLEAR}" end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
timberio-1.0.0.beta1 | lib/timber/log_devices/io/formatter.rb |