Software / code / prosody
Comparison
core/loggingmanager.lua @ 1343:a0bee511d144
loggingmanager: Enable debug level for default file logging when 'debug' mode is enabled in the config
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 19 Jun 2009 17:22:16 +0100 |
| parent | 1117:360ec48ea780 |
| child | 1344:ca74a6a38dfb |
comparison
equal
deleted
inserted
replaced
| 1342:947d94e3619f | 1343:a0bee511d144 |
|---|---|
| 10 local getstyle, getstring = require "util.termcolours".getstyle, require "util.termcolours".getstring; | 10 local getstyle, getstring = require "util.termcolours".getstyle, require "util.termcolours".getstring; |
| 11 | 11 |
| 12 local config = require "core.configmanager"; | 12 local config = require "core.configmanager"; |
| 13 local eventmanager = require "core.eventmanager"; | 13 local eventmanager = require "core.eventmanager"; |
| 14 local logger = require "util.logger"; | 14 local logger = require "util.logger"; |
| 15 local debug_mode = config.get("*", "core", "debug"); | |
| 15 | 16 |
| 16 _G.log = logger.init("general"); | 17 _G.log = logger.init("general"); |
| 17 | 18 |
| 18 module "loggingmanager" | 19 module "loggingmanager" |
| 19 | 20 |
| 20 -- The log config used if none specified in the config file | 21 -- The log config used if none specified in the config file |
| 21 local default_logging = { { to = "console" } }; | 22 local default_logging = { { to = "console" } }; |
| 22 local default_file_logging = { { to = "file", levels = { min = "info" } } }; | 23 local default_file_logging = { { to = "file", levels = { min = (debug_mode and "debug") or "info" } } }; |
| 23 local default_timestamp = "%b %d %T"; | 24 local default_timestamp = "%b %d %T"; |
| 24 -- The actual config loggingmanager is using | 25 -- The actual config loggingmanager is using |
| 25 local logging_config = config.get("*", "core", "log") or default_logging; | 26 local logging_config = config.get("*", "core", "log") or default_logging; |
| 26 | 27 |
| 27 local apply_sink_rules; | 28 local apply_sink_rules; |