Mercurial > prosody-hg
comparison core/loggingmanager.lua @ 6779:6236668da30a
core.*: Remove use of module() function
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 21 Feb 2015 10:42:19 +0100 |
| parents | 0ef7a8c8fe8c |
| children | 93771dad3e05 |
comparison
equal
deleted
inserted
replaced
| 6778:4009ae66e0f0 | 6779:6236668da30a |
|---|---|
| 25 local logger = require "util.logger"; | 25 local logger = require "util.logger"; |
| 26 local prosody = prosody; | 26 local prosody = prosody; |
| 27 | 27 |
| 28 _G.log = logger.init("general"); | 28 _G.log = logger.init("general"); |
| 29 | 29 |
| 30 module "loggingmanager" | 30 local _ENV = nil; |
| 31 | 31 |
| 32 -- The log config used if none specified in the config file (see reload_logging for initialization) | 32 -- The log config used if none specified in the config file (see reload_logging for initialization) |
| 33 local default_logging; | 33 local default_logging; |
| 34 local default_file_logging; | 34 local default_file_logging; |
| 35 local default_timestamp = "%b %d %H:%M:%S"; | 35 local default_timestamp = "%b %d %H:%M:%S"; |
| 134 end | 134 end |
| 135 return set; | 135 return set; |
| 136 end | 136 end |
| 137 | 137 |
| 138 -- Initialize config, etc. -- | 138 -- Initialize config, etc. -- |
| 139 function reload_logging() | 139 local function reload_logging() |
| 140 local old_sink_types = {}; | 140 local old_sink_types = {}; |
| 141 | 141 |
| 142 for name, sink_maker in pairs(log_sink_types) do | 142 for name, sink_maker in pairs(log_sink_types) do |
| 143 old_sink_types[name] = sink_maker; | 143 old_sink_types[name] = sink_maker; |
| 144 log_sink_types[name] = nil; | 144 log_sink_types[name] = nil; |
| 265 end | 265 end |
| 266 flush(logfile); | 266 flush(logfile); |
| 267 end; | 267 end; |
| 268 end | 268 end |
| 269 | 269 |
| 270 function register_sink_type(name, sink_maker) | 270 local function register_sink_type(name, sink_maker) |
| 271 local old_sink_maker = log_sink_types[name]; | 271 local old_sink_maker = log_sink_types[name]; |
| 272 log_sink_types[name] = sink_maker; | 272 log_sink_types[name] = sink_maker; |
| 273 return old_sink_maker; | 273 return old_sink_maker; |
| 274 end | 274 end |
| 275 | 275 |
| 276 return _M; | 276 return { |
| 277 reload_logging = reload_logging; | |
| 278 register_sink_type = register_sink_type; | |
| 279 } |
