Changeset

240:e27bf761bea6

verse: set_log_handler(): Allow nil to be passed for log_handler to disable logging (the default).
author Matthew Wild <mwild1@gmail.com>
date Sun, 27 Nov 2011 22:50:21 +0000
parents 239:65a0d3fcbbad
children 241:931bf313c691
files init.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/init.lua	Sun Nov 27 22:48:02 2011 +0000
+++ b/init.lua	Sun Nov 27 22:50:21 2011 +0000
@@ -40,8 +40,10 @@
 function verse.set_log_handler(log_handler, levels)
 	levels = levels or { "debug", "info", "warn", "error" };
 	logger.reset();
-	for i, level in ipairs(levels) do
-		logger.add_level_sink(level, log_handler);
+	if log_handler then
+		for i, level in ipairs(levels) do
+			logger.add_level_sink(level, log_handler);
+		end
 	end
 end