Comparison

core/loggingmanager.lua @ 6722:d022cb4486bd

Merge 0.10->trunk
author Matthew Wild <mwild1@gmail.com>
date Tue, 19 May 2015 09:31:12 +0100
parent 6719:0ef7a8c8fe8c
child 6779:6236668da30a
comparison
equal deleted inserted replaced
6705:c269ab6ab98a 6722:d022cb4486bd
175 end 175 end
176 176
177 -- Column width for "source" (used by stdout and console) 177 -- Column width for "source" (used by stdout and console)
178 local sourcewidth = 20; 178 local sourcewidth = 20;
179 179
180 function log_sink_types.stdout(config) 180 function log_sink_types.stdout(sink_config)
181 local timestamps = config.timestamps; 181 local timestamps = sink_config.timestamps;
182 182
183 if timestamps == true then 183 if timestamps == true then
184 timestamps = default_timestamp; -- Default format 184 timestamps = default_timestamp; -- Default format
185 end 185 end
186 186
205 if do_pretty_printing then 205 if do_pretty_printing then
206 logstyles["info"] = getstyle("bold"); 206 logstyles["info"] = getstyle("bold");
207 logstyles["warn"] = getstyle("bold", "yellow"); 207 logstyles["warn"] = getstyle("bold", "yellow");
208 logstyles["error"] = getstyle("bold", "red"); 208 logstyles["error"] = getstyle("bold", "red");
209 end 209 end
210 function log_sink_types.console(config) 210 function log_sink_types.console(sink_config)
211 -- Really if we don't want pretty colours then just use plain stdout 211 -- Really if we don't want pretty colours then just use plain stdout
212 if not do_pretty_printing then 212 if not do_pretty_printing then
213 return log_sink_types.stdout(config); 213 return log_sink_types.stdout(sink_config);
214 end 214 end
215 215
216 local timestamps = config.timestamps; 216 local timestamps = sink_config.timestamps;
217 217
218 if timestamps == true then 218 if timestamps == true then
219 timestamps = default_timestamp; -- Default format 219 timestamps = default_timestamp; -- Default format
220 end 220 end
221 221
238 end 238 end
239 end 239 end
240 end 240 end
241 241
242 local empty_function = function () end; 242 local empty_function = function () end;
243 function log_sink_types.file(config) 243 function log_sink_types.file(sink_config)
244 local log = config.filename; 244 local log = sink_config.filename;
245 local logfile = io_open(log, "a+"); 245 local logfile = io_open(log, "a+");
246 if not logfile then 246 if not logfile then
247 return empty_function; 247 return empty_function;
248 end 248 end
249 local write, flush = logfile.write, logfile.flush; 249 local write, flush = logfile.write, logfile.flush;
250 250
251 local timestamps = config.timestamps; 251 local timestamps = sink_config.timestamps;
252 252
253 if timestamps == nil or timestamps == true then 253 if timestamps == nil or timestamps == true then
254 timestamps = default_timestamp; -- Default format 254 timestamps = default_timestamp; -- Default format
255 end 255 end
256 256