diff --git a/auth.lua b/auth.lua index be7006f..5d8ab74 100644 --- a/auth.lua +++ b/auth.lua @@ -79,6 +79,7 @@ if action == "login" then end settings.set("auth.token", token) + settings.save() io.write("Logged in as " .. username .. "\n") return end diff --git a/lns_server.lua b/lns_server.lua index bad7cff..290d85e 100644 --- a/lns_server.lua +++ b/lns_server.lua @@ -26,6 +26,13 @@ settings.define("lns_server.auth_server", { }) auth_server = settings.get("lns_server.auth_server") +settings.define("lns_server.log_level", { + description = "Log Level", + type = "string", + default = "info" +}) +log_level = settings.get("lns_server.log_level") + rednet.host("lns", settings.get("lns_server.rednet_hostname")) rednet.open(modem_location) @@ -36,6 +43,12 @@ function log(str) io.write("[" .. os.time() .. "] " .. str .. "\n") end +function log_debug(str) + if log_level == "debug" then + log(str) + end +end + function save_data() db = fs.open("lns.db", "w") db.write(textutils.serialize(data)) @@ -103,6 +116,7 @@ while true do }) local auth_response = rednet.receive() + log_debug("Auth response: " .. auth_response) local errorPos, errorEnd = string.find(auth_response, "invalid") if errorPos then log("Error: " .. auth_response)