aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2014-10-30 14:37:34 -0700
committerelijah <elijah@riseup.net>2014-10-30 14:37:34 -0700
commita24cd0bd22c2ab9a452c1992fa4e9b3691c1c991 (patch)
treebe37f788d6a8114b5bc292f41bde6e142a27dd1d
parent49fa70f2503fa3112e9f5dcfa791f4ae49519deb (diff)
downloadleap_cli-a24cd0bd22c2ab9a452c1992fa4e9b3691c1c991.tar.gz
leap_cli-a24cd0bd22c2ab9a452c1992fa4e9b3691c1c991.tar.bz2
minor fix to bail and log level
-rw-r--r--lib/leap_cli/commands/pre.rb2
-rw-r--r--lib/leap_cli/config/object.rb6
-rw-r--r--lib/leap_cli/log.rb2
-rw-r--r--lib/leap_cli/util.rb4
4 files changed, 8 insertions, 6 deletions
diff --git a/lib/leap_cli/commands/pre.rb b/lib/leap_cli/commands/pre.rb
index 2e5c34e..4bdeefe 100644
--- a/lib/leap_cli/commands/pre.rb
+++ b/lib/leap_cli/commands/pre.rb
@@ -31,7 +31,7 @@ module LeapCli; module Commands
#
# set verbosity
#
- LeapCli.log_level = global[:verbose].to_i
+ LeapCli.set_log_level(global[:verbose].to_i)
#
# load Leapfile
diff --git a/lib/leap_cli/config/object.rb b/lib/leap_cli/config/object.rb
index 3ac5d36..489b1d2 100644
--- a/lib/leap_cli/config/object.rb
+++ b/lib/leap_cli/config/object.rb
@@ -288,23 +288,23 @@ 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
end
+ raise exc if LeapCli.log_level >= 2
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
end
+ raise exc if LeapCli.log_level >= 2
rescue SyntaxError, StandardError => exc
Util::bail! do
Util::log :error, "while evaluating node '#{self.name}'"
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
end
+ raise exc if LeapCli.log_level >= 2
end
private
diff --git a/lib/leap_cli/log.rb b/lib/leap_cli/log.rb
index f496b9a..c345107 100644
--- a/lib/leap_cli/log.rb
+++ b/lib/leap_cli/log.rb
@@ -15,7 +15,7 @@ module LeapCli
def log_level
@log_level ||= 1
end
- def log_level=(value)
+ def set_log_level(value)
@log_level = value
end
diff --git a/lib/leap_cli/util.rb b/lib/leap_cli/util.rb
index 0174158..19930d2 100644
--- a/lib/leap_cli/util.rb
+++ b/lib/leap_cli/util.rb
@@ -30,8 +30,10 @@ module LeapCli
#
def bail!(*message)
if block_given?
- LeapCli.log_level = 3
+ level = LeapCli.log_level
+ LeapCli.set_log_level(3)
yield
+ LeapCli.set_log_level(level)
elsif message
log 0, *message
end