aboutsummaryrefslogtreecommitdiff
path: root/advtrains/log.lua
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains/log.lua')
-rw-r--r--advtrains/log.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/advtrains/log.lua b/advtrains/log.lua
index 827948f..d2b71d3 100644
--- a/advtrains/log.lua
+++ b/advtrains/log.lua
@@ -1,9 +1,13 @@
-- Log accesses to driver stands and changes to switches
-advtrains.logfile = advtrains.fpath .. "_log"
+advtrains.log = function() end
-function advtrains.log (event, player, pos, data)
- local log = io.open(advtrains.logfile, "a+")
- log:write(os.date()..": "..event.." by "..player.." at "..minetest.pos_to_string(pos).." -- "..(data or "").."\n")
- log:close()
+if minetest.settings:get_bool("advtrains_enable_logging") then
+ advtrains.logfile = advtrains.fpath .. "_log"
+
+ function advtrains.log (event, player, pos, data)
+ local log = io.open(advtrains.logfile, "a+")
+ log:write(os.date()..": "..event.." by "..player.." at "..minetest.pos_to_string(pos).." -- "..(data or "").."\n")
+ log:close()
+ end
end