aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-05-05 14:20:26 +0100
committerMatthew Wild <mwild1@gmail.com>2009-05-05 14:20:26 +0100
commit794ba972aff856e82e95f20d593b8d318d23654b (patch)
tree8e18b577e3bfdd1834e4dfc747b96003fbc079b4 /core
parent2fff09895975e5b2fb3d0aee38c2f652c6029e15 (diff)
parenta4afb372653da9df1bc407230838a7bb958242ac (diff)
downloadprosody-794ba972aff856e82e95f20d593b8d318d23654b.tar.gz
prosody-794ba972aff856e82e95f20d593b8d318d23654b.zip
Merge with 0.4
Diffstat (limited to 'core')
-rw-r--r--core/loggingmanager.lua19
1 files changed, 16 insertions, 3 deletions
diff --git a/core/loggingmanager.lua b/core/loggingmanager.lua
index 58108a23..aa8f368d 100644
--- a/core/loggingmanager.lua
+++ b/core/loggingmanager.lua
@@ -10,7 +10,7 @@ local os_date, os_getenv = os.date, os.getenv;
local getstyle, getstring = require "util.termcolours".getstyle, require "util.termcolours".getstring;
local config = require "core.configmanager";
-
+local eventmanager = require "core.eventmanager";
local logger = require "util.logger";
_G.log = logger.init("general");
@@ -190,12 +190,26 @@ do
end
end
+local empty_function = function () end;
function log_sink_types.file(config)
local log = config.filename;
local logfile = io_open(log, "a+");
if not logfile then
- return function () end
+ return empty_function;
end
+ local write, flush = logfile.write, logfile.flush;
+
+ eventmanager.add_event_hook("reopen-log-files", function ()
+ if logfile then
+ logfile:close();
+ end
+ logfile = io_open(log, "a+");
+ if not logfile then
+ write, flush = empty_function, empty_function;
+ else
+ write, flush = logfile.write, logfile.flush;
+ end
+ end);
local timestamps = config.timestamps;
@@ -203,7 +217,6 @@ function log_sink_types.file(config)
timestamps = default_timestamp; -- Default format
end
- local write, format, flush = logfile.write, format, logfile.flush;
return function (name, level, message, ...)
if timestamps then
write(logfile, os_date(timestamps), " ");