Module: Ruport

Defined in:
lib/ruport/data_row.rb,
lib/ruport.rb,
lib/ruport/query.rb,
lib/ruport/config.rb,
lib/ruport/format.rb,
lib/ruport/parser.rb,
lib/ruport/report.rb,
lib/ruport/data_set.rb,
lib/ruport/report/mailer.rb,
lib/ruport/format/builder.rb,
lib/ruport/format/document.rb,
lib/ruport/query/sql_split.rb,
lib/ruport/format/open_node.rb

Overview

– sqlsplit.rb : A tool to properly split SQL input

This is Free Software. You may freely redistribute or modify under the terms of the GNU General Public License or the Ruby License. See LICENSE and COPYING for details.

Created by Francis Hwang, 2005.12.31 Copyright © 2005, All Rights Reserved. ++

Defined Under Namespace

Classes: Config, DataRow, DataSet, Format, Parser, Query, Report

Constant Summary collapse

VERSION =
"Ruport Version 0.3.8 (Developmental)"

Class Method Summary collapse

Class Method Details

.complain(message, options = {}) ⇒ Object

Ruports logging and error interface. Can generate warnings or raise fatal errors

Takes a message to display and a set of options. Will log to the file defined by Config::log_file

Options:

:status

sets the severity level. defaults to :warn

:output

optional secondary output, defaults to $stderr

:level

set to :log_only to disable secondary output

:exception

exception to throw on fail. Defaults to RunTimeError

The status :warn will invoke Logger#warn. A status of :fatal will invoke Logger#fatal and raise an exception

By default, complain will also print warnings to $stderr You can redirect this to any I/O object via :output

You can prevent messages from appearing on the secondary output by setting :level to :log_only

If you want to recover these messages to secondary output for debugging, you can use Config::enable_paranoia



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/ruport.rb', line 40

def Ruport.complain(message,options={})
  options[:status] ||= :warn
  options[:output] ||= $stderr
  case(options[:status])
  when :warn
    Ruport::Config::logger.warn(message) if Ruport::Config::logger
  when :fatal
    Ruport::Config::logger.fatal(message) if Ruport::Config::logger
    raise options[:exception] || RuntimeError, message
  end
  options[:output].puts "[!!] #{message}" unless 
    options[:level].eql?(:log_only) and not Ruport::Config.paranoid?
end