From 224b610aac723719c4601d5249c3dba3cb7bfecf Mon Sep 17 00:00:00 2001 From: Chase Eller Date: Wed, 25 Mar 2026 17:41:35 -0400 Subject: [PATCH] SLF Updates --- CHANGELOG.md | 6 +++++- package.json | 2 +- snippets/cstmcommonfunctions.code-snippets | 18 +++++++++++++----- template/base/client/client.lua | 5 ++++- template/base/server/server.lua | 5 +++++ template/withFeature/client/client.lua | 4 ++++ template/withFeature/server/server.lua | 4 ++++ 7 files changed, 36 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f99e90..0da78db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,4 +25,8 @@ I will use this area to keep up with what i did last. ## [Release 1.1.3] - Updated snippets for SLF to align with new coding processes -- Updated templates for resource builder to build to new coding process \ No newline at end of file +- Updated templates for resource builder to build to new coding process + +## [Release 1.1.4] + +- Updated logging functions on all scripts and snippets to allow for the new on the fly log change. \ No newline at end of file diff --git a/package.json b/package.json index 5414c0a..8d5ee5f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "cstmgames-fivem-snippets", "displayName": "CSTMGames FiveM Dev Tools", "description": "Development tools for FiveM", - "version": "1.1.3", + "version": "1.1.4", "author": { "name": "Chase Eller", "email": "chase@cstmgames.com", diff --git a/snippets/cstmcommonfunctions.code-snippets b/snippets/cstmcommonfunctions.code-snippets index 124df83..1be700b 100644 --- a/snippets/cstmcommonfunctions.code-snippets +++ b/snippets/cstmcommonfunctions.code-snippets @@ -39,7 +39,7 @@ ], "description": "Sets up command to be registered" }, - "SLF Functions and Vars for SERVER.": { + "SLF Functions and Vars for server.": { "prefix": "SLFSERVER", "body": [ "--GLOBAL CONSTANTS", @@ -77,11 +77,15 @@ " end", " local value = \"{\"..CLASS..\".\"..name..\"(\"..line..\")} \"..message", " exports.SLF:LogServerToDiscord(RESOURCE_CODE, message)", - "end" + "end", + "RegisterNetEvent(RESOURCE_CODE..\":UpdateLogLevel\")", + "AddEventHandler(RESOURCE_CODE..\":UpdateLogLevel\", function(num)", + " LOG_LEVEL = num", + "end)" ], - "description": "SLF Functions and Vars for SERVER." + "description": "SLF Functions and Vars for server." }, - "SLF Functions and Vars for CLIENT.": { + "SLF Functions and Vars for client.": { "prefix": "SLFCLIENT", "body": [ "--GLOBAL CONSTANTS", @@ -108,7 +112,11 @@ " 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" + "end", + "RegisterNetEvent(RESOURCE_CODE..\":UpdateLogLevel\")", + "AddEventHandler(RESOURCE_CODE..\":UpdateLogLevel\", function(num)", + " LOG_LEVEL = num", + "end)" ], "description": "SLF Functions and Vars for client." }, diff --git a/template/base/client/client.lua b/template/base/client/client.lua index 706c3f4..5a06d3a 100644 --- a/template/base/client/client.lua +++ b/template/base/client/client.lua @@ -23,7 +23,10 @@ local function Log(message, logLevel) Log("Warning line was logged without a level value... Logged it as debug as that is the safest route.", 1) end end - +RegisterNetEvent(RESOURCE_CODE..":UpdateLogLevel") +AddEventHandler(RESOURCE_CODE..":UpdateLogLevel", function(num) + LOG_LEVEL = num +end) --LOCAL VARIABLES --END CONFIG diff --git a/template/base/server/server.lua b/template/base/server/server.lua index 26226f9..b9a2d77 100644 --- a/template/base/server/server.lua +++ b/template/base/server/server.lua @@ -34,6 +34,11 @@ local function DisLog(message) local value = "{"..CLASS.."."..name.."("..line..")} "..message exports.SLF:LogServerToDiscord(RESOURCE_CODE, message) end + +RegisterNetEvent(RESOURCE_CODE..":UpdateLogLevel") +AddEventHandler(RESOURCE_CODE..":UpdateLogLevel", function(num) + LOG_LEVEL = num +end) --Global Variables --LOCAL VARIABLES diff --git a/template/withFeature/client/client.lua b/template/withFeature/client/client.lua index 706c3f4..7912e45 100644 --- a/template/withFeature/client/client.lua +++ b/template/withFeature/client/client.lua @@ -23,6 +23,10 @@ local function Log(message, logLevel) Log("Warning line was logged without a level value... Logged it as debug as that is the safest route.", 1) end end +RegisterNetEvent(RESOURCE_CODE..":UpdateLogLevel") +AddEventHandler(RESOURCE_CODE..":UpdateLogLevel", function(num) + LOG_LEVEL = num +end) --LOCAL VARIABLES diff --git a/template/withFeature/server/server.lua b/template/withFeature/server/server.lua index 26226f9..a9adb5d 100644 --- a/template/withFeature/server/server.lua +++ b/template/withFeature/server/server.lua @@ -34,6 +34,10 @@ local function DisLog(message) local value = "{"..CLASS.."."..name.."("..line..")} "..message exports.SLF:LogServerToDiscord(RESOURCE_CODE, message) end +RegisterNetEvent(RESOURCE_CODE..":UpdateLogLevel") +AddEventHandler(RESOURCE_CODE..":UpdateLogLevel", function(num) + LOG_LEVEL = num +end) --Global Variables --LOCAL VARIABLES