Module: LogBuddy
- Extended by:
- Utils
- Defined in:
- lib/log_buddy.rb,
lib/log_buddy/mixin.rb,
lib/log_buddy/utils.rb,
lib/log_buddy/version.rb,
lib/log_buddy/gem_logger.rb
Overview
LogBuddy is a developer tool for easy logging while testing, debugging, and inspecting.
The log shortcut method to give you easy, concise output of variables with their names and values.
Examples:
a = "foo"
@a = "my var"
def
"woof!"
end
d { a } # logs "a = 'foo'"
d { @a } # logs "@a = 'my var'"
d { } # logs "bark = woof!"
Defined Under Namespace
Modules: GemLogger, Mixin, Utils, VERSION
Class Method Summary collapse
-
.init(options = {}) ⇒ Object
Configure and include LogBuddy into Object.
- .log_to_stdout? ⇒ Boolean
- .logger ⇒ Object
-
.mixin_to_object ⇒ Object
Add the LogBuddy::Mixin to Object instance and class level.
Methods included from Utils
arg_and_blk_debug, debug, obj_to_string, parse_args, read_line, stdout_puts
Class Method Details
.init(options = {}) ⇒ Object
Configure and include LogBuddy into Object. You can pass in any of the following configuration options:
-
:logger- the logger instance that LogBuddy should use (if not provided, tries to default to RAILS_DEFAULT_LOGGER, and then to a STDOUT logger). -
<tt):log_to_stdout</tt> - whether LogBuddy should also log to STDOUT, very helpful for Autotest (default is
true). -
:disabled- when true, LogBuddy will not produce any output -
:log_gems- log Gem activation process - useful for tracking down Gem activation errors (default isfalse)
32 33 34 35 36 37 38 39 |
# File 'lib/log_buddy.rb', line 32 def self.init( = {}) @logger = [:logger] @log_to_stdout = .has_key?(:log_to_stdout) ? [:log_to_stdout] : true @log_gems = [:log_gems] @disabled = ([:disabled] == true) mixin_to_object GemLogger.log_gems! if @log_gems end |
.log_to_stdout? ⇒ Boolean
56 57 58 |
# File 'lib/log_buddy.rb', line 56 def log_to_stdout? @log_to_stdout end |
.logger ⇒ Object
51 52 53 54 |
# File 'lib/log_buddy.rb', line 51 def logger return @logger if @logger @logger = init_default_logger end |