Software /
code /
prosody
Comparison
core/loggingmanager.lua @ 2586:26ead5e16cd3
loggingmanager: Trailing whitespace
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 11 Feb 2010 11:04:26 +0000 |
parent | 2139:625b2d3e8900 |
child | 2925:692b3c6c5bd2 |
comparison
equal
deleted
inserted
replaced
2585:a9e99897b2e8 | 2586:26ead5e16cd3 |
---|---|
92 if sink_config.to == sink_type then | 92 if sink_config.to == sink_type then |
93 add_rule(sink_config); | 93 add_rule(sink_config); |
94 end | 94 end |
95 end | 95 end |
96 elseif type(logging_config) == "string" and (not logging_config:match("^%*")) and sink_type == "file" then | 96 elseif type(logging_config) == "string" and (not logging_config:match("^%*")) and sink_type == "file" then |
97 -- User specified simply a filename, and the "file" sink type | 97 -- User specified simply a filename, and the "file" sink type |
98 -- was just added | 98 -- was just added |
99 for _, sink_config in pairs(default_file_logging) do | 99 for _, sink_config in pairs(default_file_logging) do |
100 sink_config.filename = logging_config; | 100 sink_config.filename = logging_config; |
101 add_rule(sink_config); | 101 add_rule(sink_config); |
102 sink_config.filename = nil; | 102 sink_config.filename = nil; |
126 elseif max == level then | 126 elseif max == level then |
127 set[level] = true; | 127 set[level] = true; |
128 return set; | 128 return set; |
129 elseif in_range then | 129 elseif in_range then |
130 set[level] = true; | 130 set[level] = true; |
131 end | 131 end |
132 end | 132 end |
133 end | 133 end |
134 | 134 |
135 for _, level in ipairs(criteria) do | 135 for _, level in ipairs(criteria) do |
136 set[level] = true; | 136 set[level] = true; |
159 sourcewidth = math_max(#name+2, sourcewidth); | 159 sourcewidth = math_max(#name+2, sourcewidth); |
160 local namelen = #name; | 160 local namelen = #name; |
161 if timestamps then | 161 if timestamps then |
162 io_write(os_date(timestamps), " "); | 162 io_write(os_date(timestamps), " "); |
163 end | 163 end |
164 if ... then | 164 if ... then |
165 io_write(name, rep(" ", sourcewidth-namelen), level, "\t", format(message, ...), "\n"); | 165 io_write(name, rep(" ", sourcewidth-namelen), level, "\t", format(message, ...), "\n"); |
166 else | 166 else |
167 io_write(name, rep(" ", sourcewidth-namelen), level, "\t", message, "\n"); | 167 io_write(name, rep(" ", sourcewidth-namelen), level, "\t", message, "\n"); |
168 end | 168 end |
169 end | 169 end |
170 end | 170 end |
171 | 171 |
172 do | 172 do |
173 local do_pretty_printing = not os_getenv("WINDIR"); | 173 local do_pretty_printing = not os_getenv("WINDIR"); |
174 | 174 |
195 local namelen = #name; | 195 local namelen = #name; |
196 | 196 |
197 if timestamps then | 197 if timestamps then |
198 io_write(os_date(timestamps), " "); | 198 io_write(os_date(timestamps), " "); |
199 end | 199 end |
200 if ... then | 200 if ... then |
201 io_write(name, rep(" ", sourcewidth-namelen), getstring(logstyles[level], level), "\t", format(message, ...), "\n"); | 201 io_write(name, rep(" ", sourcewidth-namelen), getstring(logstyles[level], level), "\t", format(message, ...), "\n"); |
202 else | 202 else |
203 io_write(name, rep(" ", sourcewidth-namelen), getstring(logstyles[level], level), "\t", message, "\n"); | 203 io_write(name, rep(" ", sourcewidth-namelen), getstring(logstyles[level], level), "\t", message, "\n"); |
204 end | 204 end |
205 end | 205 end |
235 | 235 |
236 return function (name, level, message, ...) | 236 return function (name, level, message, ...) |
237 if timestamps then | 237 if timestamps then |
238 write(logfile, os_date(timestamps), " "); | 238 write(logfile, os_date(timestamps), " "); |
239 end | 239 end |
240 if ... then | 240 if ... then |
241 write(logfile, name, "\t", level, "\t", format(message, ...), "\n"); | 241 write(logfile, name, "\t", level, "\t", format(message, ...), "\n"); |
242 else | 242 else |
243 write(logfile, name, "\t" , level, "\t", message, "\n"); | 243 write(logfile, name, "\t" , level, "\t", message, "\n"); |
244 end | 244 end |
245 flush(logfile); | 245 flush(logfile); |