summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2010-11-13 14:31:46 +0000
committerChristian Pointner <equinox@spreadspace.org>2010-11-13 14:31:46 +0000
commitd18bab5fde2a10d0291b393113e08448bacafc2c (patch)
tree22b16f8feee69a5bcc1bc92dbaf3da7227e26ccb
parentintroduced module types (diff)
fixed dummy modules missing require
improved debug shell log output git-svn-id: https://svn.spreadspace.org/gcsd/trunk@25 ac14a137-c7f1-4531-abe0-07747231d213
-rw-r--r--src/modules/debug_shell.lua13
-rw-r--r--src/modules/dummy.lua2
2 files changed, 9 insertions, 6 deletions
diff --git a/src/modules/debug_shell.lua b/src/modules/debug_shell.lua
index 1c473bd..72be4e7 100644
--- a/src/modules/debug_shell.lua
+++ b/src/modules/debug_shell.lua
@@ -188,14 +188,15 @@ function debug_shell:new(config)
end
function debug_shell:exec_cmd(socket)
- log.printf(log.DEBUG, "debug shell: received string: '%s'", socket.in_buffer)
+ local client_name = socket.client_instance.name
+ log.printf(log.DEBUG, client_name .. ": received string: '%s'", socket.in_buffer)
local ret = defines.OK
local luacode = string.match(socket.in_buffer, "^!(.*)$");
if(luacode and luacode ~= "") then
local chunk = loadstring(luacode)
if(chunk) then
- log.printf(log.DEBUG, "debug shell: calling lua command: '%s'", luacode)
+ log.printf(log.DEBUG, client_name .. ": calling lua command: '%s'", luacode)
local results = { pcall(chunk) }
if(results[1]) then
for i,result in ipairs(results) do
@@ -214,19 +215,19 @@ function debug_shell:exec_cmd(socket)
if(cmd == 'quit') then
if(sep and sep ~= "") then socket.out_buffer = socket.out_buffer .. "unknown command\n" end
- log.printf(log.INFO, "debug shell: quitting debug session")
+ log.printf(log.INFO, client_name .. ": quitting debug session")
ret = defines.KILL_CLIENT
elseif(cmd == 'disable') then
if(sep and sep ~= "") then socket.out_buffer = socket.out_buffer .. "unknown command\n" end
- log.printf(log.NOTICE, "debug shell: disabling this debug shell instance and close all connections")
+ log.printf(log.NOTICE, client_name .. ": disabling this debug shell instance and close all connections")
ret = defines.KILL_MODULE
elseif(cmd == 'disableall') then
if(sep and sep ~= "") then socket.out_buffer = socket.out_buffer .. "unknown command\n" end
- log.printf(log.NOTICE, "debug shell: disabling all debug shell instances and close all connections")
+ log.printf(log.NOTICE, client_name .. ": disabling all debug shell instances and close all connections")
ret = defines.KILL_MODULE_CLASS
elseif(cmd == 'terminate') then
if(sep and sep ~= "") then socket.out_buffer = socket.out_buffer .. "unknown command\n" end
- log.printf(log.NOTICE, "debug shell: terminate command received")
+ log.printf(log.NOTICE, client_name .. ": terminate command received")
ret = defines.KILL_DAEMON
elseif(cmd == 'help') then
if(sep and sep ~= "") then socket.out_buffer = socket.out_buffer .. "unknown command\n" end
diff --git a/src/modules/dummy.lua b/src/modules/dummy.lua
index dab1ca6..09004ab 100644
--- a/src/modules/dummy.lua
+++ b/src/modules/dummy.lua
@@ -30,6 +30,8 @@
-- along with gcsd. If not, see <http://www.gnu.org/licenses/>.
--
+local defines = require("defines")
+
-- dummy module class
local dummy = {}
dummy.properties = { type=defines.INOUT_MODULE, name="dummy", max_instances=-1 }