|  |  | @ -33,7 +33,7 @@ class AnsiFormatter < SemanticLogger::Formatters::Color | 
			
		
	
		
			
				
					|  |  |  |     self.logger = logger | 
			
		
	
		
			
				
					|  |  |  |     self.color = color_map[log.level] | 
			
		
	
		
			
				
					|  |  |  |     wrap_length = compute_useful_length | 
			
		
	
		
			
				
					|  |  |  |     wrap_level(level, wrap_length, message, payload, exception) | 
			
		
	
		
			
				
					|  |  |  |     wrap_level(wrap_length, message, payload, exception) | 
			
		
	
		
			
				
					|  |  |  |   end | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   def origin | 
			
		
	
	
		
			
				
					|  |  | @ -59,6 +59,11 @@ class AnsiFormatter < SemanticLogger::Formatters::Color | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   private | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   def colorize(text, tint = color)    = "#{tint}#{text}#{AnsiColors::CLEAR}" | 
			
		
	
		
			
				
					|  |  |  |   def build_prefix                    = "#{origin} #{colorize(draw_rails(level_char))}  " | 
			
		
	
		
			
				
					|  |  |  |   def build_continuation              = "#{origin} #{colorize(draw_rails('┆'))}  " | 
			
		
	
		
			
				
					|  |  |  |   def draw_rails(char)                = "╣#{char}╠" | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   def compute_useful_length | 
			
		
	
		
			
				
					|  |  |  |     IO.console.winsize[1] - FOREMAN_PREFIX_LENGTH | 
			
		
	
		
			
				
					|  |  |  |   rescue StandardError | 
			
		
	
	
		
			
				
					|  |  | @ -72,15 +77,18 @@ class AnsiFormatter < SemanticLogger::Formatters::Color | 
			
		
	
		
			
				
					|  |  |  |     backtrace.compact.join("\n") | 
			
		
	
		
			
				
					|  |  |  |   end | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   def colorize(text, tint = color) | 
			
		
	
		
			
				
					|  |  |  |     "#{tint}#{text}#{AnsiColors::CLEAR}" | 
			
		
	
		
			
				
					|  |  |  |   def level_char | 
			
		
	
		
			
				
					|  |  |  |     case log.level | 
			
		
	
		
			
				
					|  |  |  |     when :info, :debug then ' ' | 
			
		
	
		
			
				
					|  |  |  |     else log.level.to_s.chr.upcase | 
			
		
	
		
			
				
					|  |  |  |     end | 
			
		
	
		
			
				
					|  |  |  |   end | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   def wrap_level(level, length, *items) | 
			
		
	
		
			
				
					|  |  |  |     prefix = "#{origin} #{colorize('>')} " | 
			
		
	
		
			
				
					|  |  |  |     continuation = "#{origin} #{colorize('#')} " | 
			
		
	
		
			
				
					|  |  |  |   def wrap_level(length, *items) | 
			
		
	
		
			
				
					|  |  |  |     prefix = build_prefix | 
			
		
	
		
			
				
					|  |  |  |     continuation = build_continuation | 
			
		
	
		
			
				
					|  |  |  |     items.map do |item| | 
			
		
	
		
			
				
					|  |  |  |       AnsiWrapper.wrap(item, length, prefix, continuation) | 
			
		
	
		
			
				
					|  |  |  |     end.compact.join("\n") # FIXME: previously was: join(' ') | 
			
		
	
		
			
				
					|  |  |  |     end.compact.join("\n") | 
			
		
	
		
			
				
					|  |  |  |   end | 
			
		
	
		
			
				
					|  |  |  | end |