change _debug to _syslog

This commit is contained in:
kepler155c@gmail.com
2019-05-03 15:30:37 -04:00
parent 074e0742d5
commit 731fc2c761
31 changed files with 264 additions and 204 deletions

View File

@@ -82,7 +82,7 @@ local function backupNode(node)
}
local s, m = pcall(function()
if not node.adapter.isDiskPresent() then
_G._debug('BACKUP error: No media present')
_G._syslog('BACKUP error: No media present')
else
local dir = node.adapter.getMountPath()
for _, v in pairs(files) do
@@ -91,7 +91,7 @@ local function backupNode(node)
end
end)
if not s and m then
_G._debug('BACKUP error:' .. m)
_G._syslog('BACKUP error:' .. m)
end
end
@@ -105,7 +105,7 @@ function BackupTask:cycle()
for node in context.storage:filterActive('backup') do
if not drives[node.name] then
drives[node.name] = Event.onInterval(DAY, function()
_G._debug('BACKUP: started')
_G._syslog('BACKUP: started')
if node.adapter and node.adapter.online then
backupNode(node)
end

View File

@@ -75,7 +75,7 @@ function ImportTask:cycle(context)
end
function tasks:onError(msg)
_G._debug('IMPORT error: ' .. msg)
_G._syslog('IMPORT error: ' .. msg)
end
tasks:run()
end

View File

@@ -11,7 +11,7 @@ function RefreshTask:cycle(context)
for node, adapter in context.storage:onlineAdapters() do
if node.refreshInterval then
if not adapter.lastRefresh or adapter.lastRefresh + node.refreshInterval < now then
_G._debug('REFRESHER: ' .. (node.displayName or node.name))
_G._syslog('REFRESHER: ' .. (node.displayName or node.name))
context.storage.dirty = true
adapter.dirty = true
adapter.lastRefresh = now

View File

@@ -13,7 +13,7 @@ local function getNameSafe(v)
name = v.getName()
end)
if not s then
_G._debug(m)
_G._syslog(m)
end
return name
end
@@ -35,7 +35,7 @@ local function compactList(list)
end
local function client(socket)
_G._debug('REMOTE: connection from ' .. socket.dhost)
_G._syslog('REMOTE: connection from ' .. socket.dhost)
local user = socket:read(2)
if not user then
@@ -44,7 +44,7 @@ local function client(socket)
local manipulator = getManipulatorForUser(user)
if not manipulator then
_G._debug('REMOTE: Manipulator with introspection module bound with user not found. Closing connection.')
_G._syslog('REMOTE: Manipulator with introspection module bound with user not found. Closing connection.')
socket:write({
msg = 'Manipulator not found'
})
@@ -52,7 +52,7 @@ local function client(socket)
return
end
_G._debug('REMOTE: all good')
_G._syslog('REMOTE: all good')
socket:write({
data = 'ok',
})
@@ -166,7 +166,7 @@ local function client(socket)
end
until not socket.connected
_G._debug('REMOTE: disconnected from ' .. socket.dhost)
_G._syslog('REMOTE: disconnected from ' .. socket.dhost)
end
local handler
@@ -174,7 +174,7 @@ local handler
local function listen()
if device.wireless_modem then
handler = Event.addRoutine(function()
_G._debug('REMOTE: listening on port 4242')
_G._syslog('REMOTE: listening on port 4242')
while true do
local socket = Socket.server(4242)
Event.addRoutine(function()
@@ -191,7 +191,7 @@ Event.on({ 'device_attach', 'device_detach' }, function(_, name)
if handler then
handler:terminate()
handler = nil
_G._debug('REMOTE: wireless modem disconnected')
_G._syslog('REMOTE: wireless modem disconnected')
else
listen()
end

View File

@@ -36,7 +36,7 @@ Event.addRoutine(function()
end
end)
if not s and m then
_G._debug(m)
_G._syslog(m)
end
end
end

View File

@@ -92,7 +92,7 @@ Event.onInterval(5, function()
end
end)
if not s and m then
_G._debug(m)
_G._syslog(m)
end
end)