diff options
author | elijah <elijah@riseup.net> | 2014-10-31 16:56:46 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2014-10-31 16:56:46 -0700 |
commit | c05f0def1b5fe4863a80bdfbac3407b011053a89 (patch) | |
tree | 9f02b206df1b09f67ec231d9cbb3f1d001bf4f20 /lib | |
parent | a9c79dbb1f8cef409b52835a3d5ee21069434f4c (diff) | |
download | leap_cli-c05f0def1b5fe4863a80bdfbac3407b011053a89.tar.gz leap_cli-c05f0def1b5fe4863a80bdfbac3407b011053a89.tar.bz2 |
only spit out stack trace if --debug
Diffstat (limited to 'lib')
-rw-r--r-- | lib/leap_cli/commands/pre.rb | 2 | ||||
-rw-r--r-- | lib/leap_cli/config/object.rb | 6 | ||||
-rw-r--r-- | lib/leap_cli/util.rb | 1 |
3 files changed, 5 insertions, 4 deletions
diff --git a/lib/leap_cli/commands/pre.rb b/lib/leap_cli/commands/pre.rb index 4bdeefe..7a64c15 100644 --- a/lib/leap_cli/commands/pre.rb +++ b/lib/leap_cli/commands/pre.rb @@ -21,7 +21,7 @@ module LeapCli; module Commands switch :yes, :negatable => false desc 'Enable debugging library (leap_cli development only)' - switch :debug, :negatable => false + switch [:d, :debug], :negatable => false desc 'Disable colors in output' default_value true diff --git a/lib/leap_cli/config/object.rb b/lib/leap_cli/config/object.rb index 45144bc..a0d402b 100644 --- a/lib/leap_cli/config/object.rb +++ b/lib/leap_cli/config/object.rb @@ -293,14 +293,14 @@ module LeapCli Util::log "offending string: #{value}", :indent => 1 Util::log "error message: no file '#{exc}'", :indent => 1 end - raise exc if LeapCli.log_level >= 2 + raise exc if DEBUG end rescue AssertionFailed => exc Util.bail! do Util::log :failed, "assertion while evaluating node '#{self.name}'" Util::log 'assertion: %s' % exc.assertion, :indent => 1 Util::log "offending key: #{key}", :indent => 1 - raise exc if LeapCli.log_level >= 2 + raise exc if DEBUG end rescue SyntaxError, StandardError => exc Util::bail! do @@ -308,7 +308,7 @@ module LeapCli Util::log "offending key: #{key}", :indent => 1 Util::log "offending string: #{value}", :indent => 1 Util::log "error message: #{exc.inspect}", :indent => 1 - raise exc if LeapCli.log_level >= 2 + raise exc if DEBUG end end diff --git a/lib/leap_cli/util.rb b/lib/leap_cli/util.rb index 43ff6f2..07ffcec 100644 --- a/lib/leap_cli/util.rb +++ b/lib/leap_cli/util.rb @@ -30,6 +30,7 @@ module LeapCli # def bail!(*message) if block_given? + LeapCli.set_log_level(3) yield elsif message log 0, *message |