summaryrefslogtreecommitdiff
path: root/lib/leap_cli/log.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2012-10-09 00:05:44 -0700
committerelijah <elijah@riseup.net>2012-10-09 00:05:44 -0700
commit73b126976ad7843eb47a84944cf191bf05b14216 (patch)
tree918656f8d7c637e8c7a8f0c010eff55bfd98ae1b /lib/leap_cli/log.rb
parent578ac2f5dc7432317d7a022bed9d869ab89ee45c (diff)
fixed paths
Diffstat (limited to 'lib/leap_cli/log.rb')
-rw-r--r--lib/leap_cli/log.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/leap_cli/log.rb b/lib/leap_cli/log.rb
new file mode 100644
index 0000000..f51ca1e
--- /dev/null
+++ b/lib/leap_cli/log.rb
@@ -0,0 +1,44 @@
+module LeapCli
+
+ def self.log_level
+ @log_level
+ end
+
+ def self.log_level=(value)
+ @log_level = value
+ end
+
+end
+
+def log0(message=nil, &block)
+ if message
+ puts message
+ elsif block
+ puts yield(block)
+ end
+end
+
+def log1(message=nil, &block)
+ if LeapCli.log_level > 0
+ if message
+ puts message
+ elsif block
+ puts yield(block)
+ end
+ end
+end
+
+def log2(message=nil, &block)
+ if LeapCli.log_level > 1
+ if message
+ puts message
+ elsif block
+ puts yield(block)
+ end
+ end
+end
+
+def help!(message=nil)
+ ENV['GLI_DEBUG'] = "false"
+ help_now!(message)
+end