Logging Update

Updated resource generating plugin to handle new logging standards moving forward for all logging functions.
This commit is contained in:
Chase Eller 2023-01-08 16:57:30 -05:00
parent ac5f36df26
commit d05b674efa
4 changed files with 23 additions and 3 deletions

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.2.1",
"version": "0.2.2",
"engines": {
"vscode": "^1.59.0"
},

View File

@ -1,3 +1,4 @@
local CLASS = "CHANGEME"--This is the name that the logging framework will use to display your logs in the correct manner
--BEGIN CONFIG
--Global Constants
local LOG_LEVEL = 4
@ -35,8 +36,14 @@ AddEventHandler(RESOURCE_CODE..":ConfigUpdate_cl", function(cfg)
end)
--SLF Server Logging Function DO NOT TOUCH unless you know what you are doing.
function Log(message, logLevel)
local line = debug.getinfo(2, "l").currentline
local name = debug.getinfo(2, "n").name
if name == "fn" then
name = "Thread"
end
local value = "{"..CLASS.."."..name.."("..line..")} "..message
if tonumber(LOG_LEVEL) >= logLevel then
exports.SLF:LogToClient(RESOURCE_CODE, logLevel, message)
exports.SLF:LogToClient(RESOURCE_CODE, logLevel, value)
end
end

View File

@ -1,3 +1,4 @@
local CLASS = "CHANGEME"--This is the name that the logging framework will use to display your logs in the correct manner
--BEGIN CONFIG
--GLOBAL CONSTANTS
local LOG_LEVEL = 4
@ -95,12 +96,24 @@ end)
--SLF Server Logging Function DO NOT TOUCH unless you know what you are doing.
function Log(message, logLevel)
local line = debug.getinfo(2, "l").currentline
local name = debug.getinfo(2, "n").name
if name == "fn" then
name = "Thread"
end
local value = "{"..CLASS.."."..name.."("..line..")} "..message
if tonumber(LOG_LEVEL) >= logLevel then
exports.SLF:LogToServer(RESOURCE_CODE, logLevel, message)
exports.SLF:LogToServer(RESOURCE_CODE, logLevel, value)
end
end
function DisLog(message)
local line = debug.getinfo(2, "l").currentline
local name = debug.getinfo(2, "n").name
if name == "fn" then
name = "Thread"
end
local value = "{"..CLASS.."."..name.."("..line..")} "..message
exports.SLF:LogServerToDiscord(RESOURCE_CODE, message)
end