Comparison

core/loggingmanager.lua @ 4126:5044698a9d90

Merge 0.8->trunk
author Matthew Wild <mwild1@gmail.com>
date Fri, 21 Jan 2011 14:02:56 +0000
parent 4124:3761aa844d65
child 4140:e463e1df1bda
comparison
equal deleted inserted replaced
4122:2e4bc196fd2a 4126:5044698a9d90
24 end 24 end
25 25
26 local config = require "core.configmanager"; 26 local config = require "core.configmanager";
27 local logger = require "util.logger"; 27 local logger = require "util.logger";
28 local prosody = prosody; 28 local prosody = prosody;
29
30 local debug_mode = config.get("*", "core", "debug");
31 29
32 _G.log = logger.init("general"); 30 _G.log = logger.init("general");
33 31
34 module "loggingmanager" 32 module "loggingmanager"
35 33
164 log_sink_types[name] = nil; 162 log_sink_types[name] = nil;
165 end 163 end
166 164
167 logger.reset(); 165 logger.reset();
168 166
167 local debug_mode = config.get("*", "core", "debug");
168
169 default_logging = { { to = "console" , levels = { min = (debug_mode and "debug") or "info" } } }; 169 default_logging = { { to = "console" , levels = { min = (debug_mode and "debug") or "info" } } };
170 default_file_logging = { 170 default_file_logging = {
171 { to = "file", levels = { min = (debug_mode and "debug") or "info" }, timestamps = true } 171 { to = "file", levels = { min = (debug_mode and "debug") or "info" }, timestamps = true }
172 }; 172 };
173 default_timestamp = "%b %d %H:%M:%S"; 173 default_timestamp = "%b %d %H:%M:%S";
193 end 193 end
194 194
195 -- Column width for "source" (used by stdout and console) 195 -- Column width for "source" (used by stdout and console)
196 local sourcewidth = 20; 196 local sourcewidth = 20;
197 197
198 function log_sink_types.stdout() 198 function log_sink_types.stdout(config)
199 local timestamps = config.timestamps; 199 local timestamps = config.timestamps;
200 200
201 if timestamps == true then 201 if timestamps == true then
202 timestamps = default_timestamp; -- Default format 202 timestamps = default_timestamp; -- Default format
203 end 203 end