aboutsummaryrefslogtreecommitdiff
path: root/advtrains/log.lua
blob: d2b71d3ff8f0b7d156f3bea5d5392893f215df89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
-- Log accesses to driver stands and changes to switches

advtrains.log = function() end

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