Mercurial > prosody-modules
comparison mod_inotify_reload/mod_inotify_reload.lua @ 744:ab988e98a9f9
mod_inotify_reload: Add debug logging
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 19 Jul 2012 15:32:02 +0100 |
parents | 3e6f43ab7e22 |
children | 82207f936f1f |
comparison
equal
deleted
inserted
replaced
743:5f7dd5336dbe | 744:ab988e98a9f9 |
---|---|
42 local id, err = inh:addwatch(path, inotify.IN_CLOSE_WRITE); | 42 local id, err = inh:addwatch(path, inotify.IN_CLOSE_WRITE); |
43 if not id then return nil, err; end | 43 if not id then return nil, err; end |
44 local k = host.."\0"..name; | 44 local k = host.."\0"..name; |
45 watches[k] = { id = id, path = path, name = name, host = host }; | 45 watches[k] = { id = id, path = path, name = name, host = host }; |
46 watch_ids[id] = k; | 46 watch_ids[id] = k; |
47 module:log("debug", "Watching %s:%s with id %d", name, host, id); | |
47 return true; | 48 return true; |
48 end | 49 end |
49 | 50 |
50 function unwatch_module(name, host) | 51 function unwatch_module(name, host) |
51 local k = host.."\0"..name; | 52 local k = host.."\0"..name; |
52 if not watches[k] then | 53 if not watches[k] then |
54 module:log("warn", "Not watching %s:%s", name, host); | |
53 return nil, "not-watching"; | 55 return nil, "not-watching"; |
54 end | 56 end |
55 local id = watches[k].id; | 57 local id = watches[k].id; |
56 local ok, err = inh:rmwatch(id); | 58 local ok, err = inh:rmwatch(id); |
59 module:log("info", "Removed watch %d", id); | |
57 watches[k] = nil; | 60 watches[k] = nil; |
58 watch_ids[id] = nil; | 61 watch_ids[id] = nil; |
59 return ok, err; | 62 return ok, err; |
60 end | 63 end |
61 | 64 |