]> gitweb.fluxo.info Git - leap/leap_cli.git/commitdiff
minor fix to bail and log level
authorelijah <elijah@riseup.net>
Thu, 30 Oct 2014 21:37:34 +0000 (14:37 -0700)
committerelijah <elijah@riseup.net>
Thu, 30 Oct 2014 21:37:34 +0000 (14:37 -0700)
lib/leap_cli/commands/pre.rb
lib/leap_cli/config/object.rb
lib/leap_cli/log.rb
lib/leap_cli/util.rb

index 2e5c34e4d8a3501b4f8abd1677eeed1f3f0aea46..4bdeefea6a407466a6222b0ec310bcad9590dff6 100644 (file)
@@ -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
index 3ac5d36c5ef7ca832085c8b3aec9564ed7543196..489b1d2f2c58c685509e216cdbb4e7c39c4005b4 100644 (file)
@@ -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
index f496b9aa0a42c04309f55af930418b28d0afebdd..c34510728cdf9985eaffee11f8d4284c6c6ed10a 100644 (file)
@@ -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
 
index 01741580f26723a3bdff6d6697daaa6c09131946..19930d2f34b5ea875e87e41be1699a03e4da8af5 100644 (file)
@@ -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