diff options
author | Peter Kozak <spag@golwen.net> | 2013-03-17 06:56:04 -0400 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-03-17 06:56:04 -0400 |
commit | e5cf06103f5d2256767530c9f3ddc2ae803926f8 (patch) | |
tree | 97eb9e8950ea12f371efff426a2bf3d6677bd640 /misc/freeswitch/scripts/common | |
parent | 35c4fcfb947afb4d5df26fdae4a6452a0c2097ff (diff) |
log enhancements
Diffstat (limited to 'misc/freeswitch/scripts/common')
-rw-r--r-- | misc/freeswitch/scripts/common/log.lua | 14 |
1 files changed, 13 insertions, 1 deletions
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 |