Software /
code /
prosody
Annotate
util/logger.lua @ 1527:47729fa90a6c
prosody.cfg.lua: Various small changes
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 10 Jul 2009 16:47:31 +0100 |
parent | 1523:841d61be198f |
child | 2923:b7049746bd29 |
rev | line source |
---|---|
1523
841d61be198f
Remove version number from copyright headers
Matthew Wild <mwild1@gmail.com>
parents:
1020
diff
changeset
|
1 -- Prosody IM |
760
90ce865eebd8
Update copyright notices for 2009
Matthew Wild <mwild1@gmail.com>
parents:
759
diff
changeset
|
2 -- Copyright (C) 2008-2009 Matthew Wild |
90ce865eebd8
Update copyright notices for 2009
Matthew Wild <mwild1@gmail.com>
parents:
759
diff
changeset
|
3 -- Copyright (C) 2008-2009 Waqas Hussain |
519
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
437
diff
changeset
|
4 -- |
758 | 5 -- This project is MIT/X11 licensed. Please see the |
6 -- COPYING file in the source package for more information. | |
519
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
437
diff
changeset
|
7 -- |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
437
diff
changeset
|
8 |
582
8eb45a8099c4
Make it possible to set custom output handler for logger
Matthew Wild <mwild1@gmail.com>
parents:
519
diff
changeset
|
9 local pcall = pcall; |
262 | 10 |
883
0112ae30f399
Support to filter logging by source via pattern matching from config file.
Tobias Markmann <tm@ayena.de>
parents:
805
diff
changeset
|
11 local config = require "core.configmanager"; |
0112ae30f399
Support to filter logging by source via pattern matching from config file.
Tobias Markmann <tm@ayena.de>
parents:
805
diff
changeset
|
12 local log_sources = config.get("*", "core", "log_sources"); |
0112ae30f399
Support to filter logging by source via pattern matching from config file.
Tobias Markmann <tm@ayena.de>
parents:
805
diff
changeset
|
13 |
884
5758c39285ab
util.logger: Small code tidying :)
Matthew Wild <mwild1@gmail.com>
parents:
883
diff
changeset
|
14 local find = string.find; |
1015
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
15 local ipairs, pairs, setmetatable = ipairs, pairs, setmetatable; |
262 | 16 |
30 | 17 module "logger" |
18 | |
1015
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
19 local name_sinks, level_sinks = {}, {}; |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
20 local name_patterns = {}; |
262 | 21 |
1015
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
22 -- Weak-keyed so that loggers are collected |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
23 local modify_hooks = setmetatable({}, { __mode = "k" }); |
262 | 24 |
1015
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
25 local make_logger; |
582
8eb45a8099c4
Make it possible to set custom output handler for logger
Matthew Wild <mwild1@gmail.com>
parents:
519
diff
changeset
|
26 local outfunction = nil; |
8eb45a8099c4
Make it possible to set custom output handler for logger
Matthew Wild <mwild1@gmail.com>
parents:
519
diff
changeset
|
27 |
30 | 28 function init(name) |
883
0112ae30f399
Support to filter logging by source via pattern matching from config file.
Tobias Markmann <tm@ayena.de>
parents:
805
diff
changeset
|
29 if log_sources then |
0112ae30f399
Support to filter logging by source via pattern matching from config file.
Tobias Markmann <tm@ayena.de>
parents:
805
diff
changeset
|
30 local log_this = false; |
0112ae30f399
Support to filter logging by source via pattern matching from config file.
Tobias Markmann <tm@ayena.de>
parents:
805
diff
changeset
|
31 for _, source in ipairs(log_sources) do |
0112ae30f399
Support to filter logging by source via pattern matching from config file.
Tobias Markmann <tm@ayena.de>
parents:
805
diff
changeset
|
32 if find(name, source) then |
884
5758c39285ab
util.logger: Small code tidying :)
Matthew Wild <mwild1@gmail.com>
parents:
883
diff
changeset
|
33 log_this = true; |
5758c39285ab
util.logger: Small code tidying :)
Matthew Wild <mwild1@gmail.com>
parents:
883
diff
changeset
|
34 break; |
883
0112ae30f399
Support to filter logging by source via pattern matching from config file.
Tobias Markmann <tm@ayena.de>
parents:
805
diff
changeset
|
35 end |
0112ae30f399
Support to filter logging by source via pattern matching from config file.
Tobias Markmann <tm@ayena.de>
parents:
805
diff
changeset
|
36 end |
0112ae30f399
Support to filter logging by source via pattern matching from config file.
Tobias Markmann <tm@ayena.de>
parents:
805
diff
changeset
|
37 |
0112ae30f399
Support to filter logging by source via pattern matching from config file.
Tobias Markmann <tm@ayena.de>
parents:
805
diff
changeset
|
38 if not log_this then return function () end end |
0112ae30f399
Support to filter logging by source via pattern matching from config file.
Tobias Markmann <tm@ayena.de>
parents:
805
diff
changeset
|
39 end |
0112ae30f399
Support to filter logging by source via pattern matching from config file.
Tobias Markmann <tm@ayena.de>
parents:
805
diff
changeset
|
40 |
1015
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
41 local log_debug = make_logger(name, "debug"); |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
42 local log_info = make_logger(name, "info"); |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
43 local log_warn = make_logger(name, "warn"); |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
44 local log_error = make_logger(name, "error"); |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
45 |
147 | 46 --name = nil; -- While this line is not commented, will automatically fill in file/line number info |
437
c1a720db2157
Nice enhancement for logging output
Matthew Wild <mwild1@gmail.com>
parents:
360
diff
changeset
|
47 local namelen = #name; |
1015
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
48 return function (level, message, ...) |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
49 if outfunction then return outfunction(name, level, message, ...); end |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
50 |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
51 if level == "debug" then |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
52 return log_debug(message, ...); |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
53 elseif level == "info" then |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
54 return log_info(message, ...); |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
55 elseif level == "warn" then |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
56 return log_warn(message, ...); |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
57 elseif level == "error" then |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
58 return log_error(message, ...); |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
59 end |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
60 end |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
61 end |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
62 |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
63 function make_logger(source_name, level) |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
64 local level_handlers = level_sinks[level]; |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
65 if not level_handlers then |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
66 level_handlers = {}; |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
67 level_sinks[level] = level_handlers; |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
68 end |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
69 |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
70 local source_handlers = name_sinks[source_name]; |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
71 |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
72 -- All your premature optimisation is belong to me! |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
73 local num_level_handlers, num_source_handlers = #level_handlers, source_handlers and #source_handlers; |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
74 |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
75 local logger = function (message, ...) |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
76 if source_handlers then |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
77 for i = 1,num_source_handlers do |
1020
8bf71f8bd0d1
util.logger: Fix for attempting to call a table
Matthew Wild <mwild1@gmail.com>
parents:
1015
diff
changeset
|
78 if source_handlers[i](source_name, level, message, ...) == false then |
1015
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
79 return; |
30 | 80 end |
81 end | |
1015
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
82 end |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
83 |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
84 for i = 1,num_level_handlers do |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
85 level_handlers[i](source_name, level, message, ...); |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
86 end |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
87 end |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
88 |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
89 -- To make sure our cached lengths stay in sync with reality |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
90 modify_hooks[logger] = function () num_level_handlers, num_source_handlers = #level_handlers, source_handlers and #source_handlers; end; |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
91 |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
92 return logger; |
30 | 93 end |
94 | |
582
8eb45a8099c4
Make it possible to set custom output handler for logger
Matthew Wild <mwild1@gmail.com>
parents:
519
diff
changeset
|
95 function setwriter(f) |
716
d61eabc678a6
util/logger: setwriter now returns the old writer on success
Waqas Hussain <waqas20@gmail.com>
parents:
615
diff
changeset
|
96 local old_func = outfunction; |
d61eabc678a6
util/logger: setwriter now returns the old writer on success
Waqas Hussain <waqas20@gmail.com>
parents:
615
diff
changeset
|
97 if not f then outfunction = nil; return true, old_func; end |
582
8eb45a8099c4
Make it possible to set custom output handler for logger
Matthew Wild <mwild1@gmail.com>
parents:
519
diff
changeset
|
98 local ok, ret = pcall(f, "logger", "info", "Switched logging output successfully"); |
8eb45a8099c4
Make it possible to set custom output handler for logger
Matthew Wild <mwild1@gmail.com>
parents:
519
diff
changeset
|
99 if ok then |
8eb45a8099c4
Make it possible to set custom output handler for logger
Matthew Wild <mwild1@gmail.com>
parents:
519
diff
changeset
|
100 outfunction = f; |
716
d61eabc678a6
util/logger: setwriter now returns the old writer on success
Waqas Hussain <waqas20@gmail.com>
parents:
615
diff
changeset
|
101 ret = old_func; |
582
8eb45a8099c4
Make it possible to set custom output handler for logger
Matthew Wild <mwild1@gmail.com>
parents:
519
diff
changeset
|
102 end |
8eb45a8099c4
Make it possible to set custom output handler for logger
Matthew Wild <mwild1@gmail.com>
parents:
519
diff
changeset
|
103 return ok, ret; |
8eb45a8099c4
Make it possible to set custom output handler for logger
Matthew Wild <mwild1@gmail.com>
parents:
519
diff
changeset
|
104 end |
8eb45a8099c4
Make it possible to set custom output handler for logger
Matthew Wild <mwild1@gmail.com>
parents:
519
diff
changeset
|
105 |
1015
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
106 function add_level_sink(level, sink_function) |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
107 if not level_sinks[level] then |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
108 level_sinks[level] = { sink_function }; |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
109 else |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
110 level_sinks[level][#level_sinks[level] + 1 ] = sink_function; |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
111 end |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
112 |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
113 for _, modify_hook in pairs(modify_hooks) do |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
114 modify_hook(); |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
115 end |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
116 end |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
117 |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
118 function add_name_sink(name, sink_function, exclusive) |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
119 if not name_sinks[name] then |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
120 name_sinks[name] = { sink_function }; |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
121 else |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
122 name_sinks[name][#name_sinks[name] + 1] = sink_function; |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
123 end |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
124 |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
125 for _, modify_hook in pairs(modify_hooks) do |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
126 modify_hook(); |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
127 end |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
128 end |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
129 |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
130 function add_name_pattern_sink(name_pattern, sink_function, exclusive) |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
131 if not name_patterns[name_pattern] then |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
132 name_patterns[name_pattern] = { sink_function }; |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
133 else |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
134 name_patterns[name_pattern][#name_patterns[name_pattern] + 1] = sink_function; |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
135 end |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
136 end |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
137 |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
138 _M.new = make_logger; |
9e31e9397cff
util.logger: Revamped logger library, but backwards-compatible for users of logger.init()
Matthew Wild <mwild1@gmail.com>
parents:
977
diff
changeset
|
139 |
360
e918c979ad1a
Remove or comment useless prints, or change them to log()
Matthew Wild <mwild1@gmail.com>
parents:
262
diff
changeset
|
140 return _M; |