diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-03-08 03:38:22 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-03-08 03:38:22 +0000 |
commit | d2ebe25dc579fb0ab21e411518c50eee1fae0f99 (patch) | |
tree | dbd3f1adee49adfd2d9865f99e4a3c2b356aa5dc /util | |
parent | 61ca31c484a4ad127d9088aaf14914c3af37a26a (diff) | |
parent | 90fa7296e47fa3439f9842b6904c35dba48364e7 (diff) | |
download | prosody-d2ebe25dc579fb0ab21e411518c50eee1fae0f99.tar.gz prosody-d2ebe25dc579fb0ab21e411518c50eee1fae0f99.zip |
Automated merge with http://waqas.ath.cx:8000/
Diffstat (limited to 'util')
-rw-r--r-- | util/logger.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/util/logger.lua b/util/logger.lua index 791e222b..2c8eea30 100644 --- a/util/logger.lua +++ b/util/logger.lua @@ -13,8 +13,13 @@ local debug = debug; local tostring = tostring; local math_max = math.max; +local config = require "core.configmanager"; +local log_sources = config.get("*", "core", "log_sources"); + local getstyle, getstring = require "util.termcolours".getstyle, require "util.termcolours".getstring; local do_pretty_printing = not os.getenv("WINDIR"); +local find = string.find; +local ipairs = ipairs; module "logger" @@ -32,6 +37,18 @@ local sourcewidth = 20; local outfunction = nil; function init(name) + if log_sources then + local log_this = false; + for _, source in ipairs(log_sources) do + if find(name, source) then + log_this = true; + break; + end + end + + if not log_this then return function () end end + end + --name = nil; -- While this line is not commented, will automatically fill in file/line number info local namelen = #name; return function (level, message, ...) |