mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Fixed few bugs
This commit is contained in:
@@ -28,22 +28,22 @@ local Container = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Container.log(level,...)
|
function Container.log(level,...)
|
||||||
if level >= Container.logLevel then Container.stdout(...) end
|
if level <= Container.logLevel then Container.stdout(...) end
|
||||||
end
|
end
|
||||||
function Container.stdout(...)
|
function Container.stdout(...)
|
||||||
local msg = ''
|
local msg = ''
|
||||||
for _,value in pairs({...}) do
|
for _,value in pairs({...}) do
|
||||||
msg = msg..' '..Container.tostring(value)
|
msg = msg..' '..Container.tostring(value)
|
||||||
end
|
end
|
||||||
if Container.handlers.log then
|
if Container.handlers.logging then
|
||||||
Container.handlers.log(msg)
|
Container.handlers.logging(msg)
|
||||||
else
|
else
|
||||||
log(msg)
|
log(msg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Container.error(...)
|
function Container.error(...)
|
||||||
if Container.safeError then Container.stdout(...) else Container.stderr(...) end
|
if Container.safeError then Container.stdout('ERROR',...) else Container.stderr(...) end
|
||||||
end
|
end
|
||||||
function Container.stderr(type,...)
|
function Container.stderr(type,...)
|
||||||
local msg = 'ERROR: '..type
|
local msg = 'ERROR: '..type
|
||||||
@@ -110,7 +110,7 @@ function Container.loadFile(filePath)
|
|||||||
local success,file = pcall(require,filePath)
|
local success,file = pcall(require,filePath)
|
||||||
if not success then return Container.error(Container.defines.errorLoad,file) end
|
if not success then return Container.error(Container.defines.errorLoad,file) end
|
||||||
if not file then return Container.error(Container.defines.errorNotFound) end
|
if not file then return Container.error(Container.defines.errorNotFound) end
|
||||||
Container.log(Container.defines.logDebug,'Loaded file: ',filePath)
|
Container.log(Container.defines.logDebug,'Loaded file:',filePath)
|
||||||
return file
|
return file
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
-- not_luadoc=true
|
--[[ not_luadoc=true
|
||||||
function _log(...) log(...) end -- do not remove this is used for smaller verbose lines
|
function _log(...) log(...) end -- do not remove this is used for smaller verbose lines
|
||||||
Manager = require("FactorioSoftmodManager")
|
Manager = require("FactorioSoftmodManager")
|
||||||
Manager.setVerbose{
|
Manager.setVerbose{
|
||||||
@@ -12,14 +12,14 @@ Manager.setVerbose{
|
|||||||
output=Manager._verbose -- can be: can be: print || log || other function
|
output=Manager._verbose -- can be: can be: print || log || other function
|
||||||
}
|
}
|
||||||
Manager() -- can be Manager.loadModules() if called else where
|
Manager() -- can be Manager.loadModules() if called else where
|
||||||
|
]]
|
||||||
|
|
||||||
--[[
|
local Container = require 'container'
|
||||||
Container = require 'container'
|
|
||||||
Container.handlers = {
|
Container.handlers = {
|
||||||
--event
|
--event
|
||||||
--global
|
--global
|
||||||
error=error,
|
error=error,
|
||||||
log=function(...) _R.log(...) end,
|
logging=function(...) log(...) end,
|
||||||
--debug
|
--debug
|
||||||
tableToString=serpent.line
|
tableToString=serpent.line
|
||||||
}
|
}
|
||||||
@@ -28,4 +28,3 @@ Container.files = {
|
|||||||
'modules.test'
|
'modules.test'
|
||||||
}
|
}
|
||||||
Container.loadFiles()
|
Container.loadFiles()
|
||||||
]]
|
|
||||||
Reference in New Issue
Block a user