Sha256: 1c2e8d60b053a9529ea0ce876fa39f6d447512f3775cf28aa3d6d53f01addb15

Contents?: true

Size: 901 Bytes

Versions: 15

Compression:

Stored size: 901 Bytes

Contents

--- LuaDist simple message logger
-- Peter Drahoš, Peter Kapec, LuaDist Project, 2010

--- Very simple log system.
-- 2DO: change to LuaLogging on next version.
-- write - write a log line
-- message - write and optionally display a message

module ("dist.log", package.seeall)

local lfs 		= require "lfs"
local config	= require "dist.config"

-- Profile to store info in
lfs.mkdir(config.temp)
local log = assert(io.open(config.log, "a"), "Could not create log file!")

--- Display and log a message
function message(...)
	if config.message then config.message(...) end
	return write(...)
end

--- Write a line to log
function write(...)

	local args = ...
	if type(...) == "string" then args = { ... } end
	if type(args) ~= "table" then return nil end

	log:write(os.date("%c", os.time()) .. ":: ")
	for i = 1, #args do
		log:write(tostring(args[i]) .. " ")
	end
	log:write("\n")
	log:flush()
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
Tamar-0.7.18 src/luadist/dist/log.lua
Tamar-0.7.17 src/luadist/dist/log.lua
Tamar-0.7.16 src/luadist/dist/log.lua
Tamar-0.7.14 src/luadist/dist/log.lua
Tamar-0.7.13 src/luadist/dist/log.lua
Tamar-0.7.12 src/luadist/dist/log.lua
Tamar-0.7.11 src/luadist/dist/log.lua
Tamar-0.7.10 src/luadist/dist/log.lua
Tamar-0.7.9 src/luadist/dist/log.lua
Tamar-0.7.8 src/luadist/dist/log.lua
Tamar-0.7.7 src/luadist/dist/log.lua
Tamar-0.7.6 src/luadist/dist/log.lua
Tamar-0.7.5 src/luadist/dist/log.lua
Tamar-0.7.4 src/luadist/dist/log.lua
Tamar-0.7.3 src/luadist/dist/log.lua