Class: Groonga::QueryLog::Analyzer::ConsoleReporter
- Defined in:
- lib/groonga/query-log/analyzer/reporter/console.rb
Defined Under Namespace
Instance Attribute Summary
Attributes inherited from Reporter
Instance Method Summary collapse
- #apply_options(options) ⇒ Object
- #finish ⇒ Object
-
#initialize(statistics) ⇒ ConsoleReporter
constructor
A new instance of ConsoleReporter.
- #report_statistic(statistic) ⇒ Object
- #report_statistics ⇒ Object
- #start ⇒ Object
Methods inherited from Reporter
Constructor Details
#initialize(statistics) ⇒ ConsoleReporter
Returns a new instance of ConsoleReporter.
119 120 121 122 123 124 125 126 127 128 |
# File 'lib/groonga/query-log/analyzer/reporter/console.rb', line 119 def initialize(statistics) super @color = :auto @reset_color = Color.new("reset") @color_schema = { :elapsed => {:foreground => :white, :background => :green}, :time => {:foreground => :white, :background => :cyan}, :slow => {:foreground => :white, :background => :red}, } end |
Instance Method Details
#apply_options(options) ⇒ Object
130 131 132 133 |
# File 'lib/groonga/query-log/analyzer/reporter/console.rb', line 130 def () super @color = [:color] || @color end |
#finish ⇒ Object
157 158 |
# File 'lib/groonga/query-log/analyzer/reporter/console.rb', line 157 def finish end |
#report_statistic(statistic) ⇒ Object
141 142 143 144 145 146 |
# File 'lib/groonga/query-log/analyzer/reporter/console.rb', line 141 def report_statistic(statistic) @index += 1 write("%*d) %s" % [@digit, @index, format_heading(statistic)]) report_parameters(statistic) report_operations(statistic) end |
#report_statistics ⇒ Object
135 136 137 138 139 |
# File 'lib/groonga/query-log/analyzer/reporter/console.rb', line 135 def report_statistics write("\n") write("Slow Queries:\n") super end |
#start ⇒ Object
148 149 150 151 152 153 154 155 |
# File 'lib/groonga/query-log/analyzer/reporter/console.rb', line 148 def start @index = 0 if @statistics.size.zero? @digit = 1 else @digit = Math.log10(@statistics.size).truncate + 1 end end |