Updates to handle new logging

This commit is contained in:
Chase Eller 2023-08-23 02:03:39 -04:00
parent fbb704ff4e
commit 171aec503c
No known key found for this signature in database
GPG Key ID: 9233D42F495E657C
5 changed files with 22 additions and 4 deletions

Binary file not shown.

View File

@ -3,7 +3,7 @@
"name": "CSTM-RESOURCE-GENERATOR",
"displayName": "CSTM Five Alive Resource Generator",
"description": "This is an internal tool to help you in creating a new basic lua resource for FiveAlive",
"version": "0.4.0",
"version": "0.5.0",
"engines": {
"vscode": "^1.59.0"
},

View File

@ -19,7 +19,11 @@ local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), "resource_co
------------------------------------------------------------------------------------------------
--SLF Server Logging Function DO NOT TOUCH unless you know what you are doing.
--SLF Server Logging Function DO NOT TOUCH unless you know what you are doing
---Used to send logs to the client console
---@param message any Preformatted message or VARIABLES to be sent to log
---@param logLevel integer Level of log, 1-Error, 2-Warn, 3-Info, 4-Debug
function Log(message, logLevel)
local line = debug.getinfo(2, "l").currentline
local name = debug.getinfo(2, "n").name
@ -27,9 +31,14 @@ function Log(message, logLevel)
name = "Thread"
end
local value = "{"..CLASS.."."..name.."("..line..")} "..message
if logLevel then
if tonumber(LOG_LEVEL) >= logLevel then
exports.SLF:LogToClient(RESOURCE_CODE, logLevel, value)
end
else
exports.SLF:LogToClient(RESOURCE_CODE, 4, value)
Log("Warning line was logged without a level value... Logged it as debug as that is the safest route.", 1)
end
end
function GetSID(UUID)

View File

@ -20,6 +20,10 @@ local RESOURCE_CODE = GetResourceMetadata(GetCurrentResourceName(), "resource_co
------------------------------------------------------------------------------------------------
--SLF Server Logging Function DO NOT TOUCH unless you know what you are doing.
---Used to send logs to the server console
---@param message any Preformatted message or VARIABLES to be sent to log
---@param logLevel integer Level of log, 1-Error, 2-Warn, 3-Info, 4-Debug
function Log(message, logLevel)
local line = debug.getinfo(2, "l").currentline
local name = debug.getinfo(2, "n").name
@ -27,9 +31,14 @@ function Log(message, logLevel)
name = "Thread"
end
local value = "{"..CLASS.."."..name.."("..line..")} "..message
if logLevel then
if tonumber(LOG_LEVEL) >= logLevel then
exports.SLF:LogToServer(RESOURCE_CODE, logLevel, value)
end
else
exports.SLF:LogToServer(RESOURCE_CODE, 4, value)
Log("Warning line was logged without a level value... Logged it as debug as that is the safest route.", 1)
end
end
function DisLog(message)