From e5cf06103f5d2256767530c9f3ddc2ae803926f8 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Sun, 17 Mar 2013 06:56:04 -0400 Subject: log enhancements --- misc/freeswitch/scripts/common/log.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'misc/freeswitch/scripts/common') diff --git a/misc/freeswitch/scripts/common/log.lua b/misc/freeswitch/scripts/common/log.lua index f224070..b9893ac 100644 --- a/misc/freeswitch/scripts/common/log.lua +++ b/misc/freeswitch/scripts/common/log.lua @@ -24,6 +24,7 @@ function Log.new(self, arg) self.level_notice = arg.level_notice or 5; self.level_info = arg.level_info or 6; self.level_debug = arg.level_debug or 7; + self.level_devel = arg.level_devel or 4; return object; end @@ -35,7 +36,12 @@ function Log.message(self, log_level, message_arguments ) local message = tostring(self.prefix); for index, value in pairs(message_arguments) do if type(index) == 'number' then - message = message .. tostring(value); + if type(value) == 'table' then + require 'common.array'; + message = message .. common.array.to_json(value); + else + message = message .. tostring(value); + end end end if self.buffer then @@ -76,3 +82,9 @@ end function Log.debug(self, ...) self:message(self.level_debug, {...}); end + +function Log.devel(self, ...) + local arguments = {...}; + table.insert(arguments, 1, '**'); + self:message(self.level_devel, arguments); +end -- cgit v1.2.3