Software / code / prosody
Comparison
core/loggingmanager.lua @ 8721:b773b15fee71
util.startup: Set up event hooks for reloading logging here instead of in loggingmanager to simplify startup dependencies
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 05 Apr 2018 17:53:51 +0200 |
| parent | 8720:dba17a70fd22 |
| child | 8750:7ae09468ad92 |
comparison
equal
deleted
inserted
replaced
| 8720:dba17a70fd22 | 8721:b773b15fee71 |
|---|---|
| 16 local os_date = os.date; | 16 local os_date = os.date; |
| 17 local getstyle, getstring = require "util.termcolours".getstyle, require "util.termcolours".getstring; | 17 local getstyle, getstring = require "util.termcolours".getstyle, require "util.termcolours".getstring; |
| 18 | 18 |
| 19 local config = require "core.configmanager"; | 19 local config = require "core.configmanager"; |
| 20 local logger = require "util.logger"; | 20 local logger = require "util.logger"; |
| 21 local prosody = prosody; | |
| 22 | 21 |
| 23 local _ENV = nil; | 22 local _ENV = nil; |
| 24 -- luacheck: std none | 23 -- luacheck: std none |
| 25 | 24 |
| 26 -- The log config used if none specified in the config file (see reload_logging for initialization) | 25 -- The log config used if none specified in the config file (see reload_logging for initialization) |
| 150 logging_config = config.get("*", "log") or default_logging; | 149 logging_config = config.get("*", "log") or default_logging; |
| 151 | 150 |
| 152 for name, sink_maker in pairs(old_sink_types) do | 151 for name, sink_maker in pairs(old_sink_types) do |
| 153 log_sink_types[name] = sink_maker; | 152 log_sink_types[name] = sink_maker; |
| 154 end | 153 end |
| 155 | 154 end |
| 156 prosody.events.fire_event("logging-reloaded"); | |
| 157 end | |
| 158 | |
| 159 reload_logging(); | |
| 160 prosody.events.add_handler("reopen-log-files", reload_logging); | |
| 161 | 155 |
| 162 --- Definition of built-in logging sinks --- | 156 --- Definition of built-in logging sinks --- |
| 163 | 157 |
| 164 -- Null sink, must enter log_sink_types *first* | 158 -- Null sink, must enter log_sink_types *first* |
| 165 local function log_to_nowhere() | 159 local function log_to_nowhere() |