mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
refactor(print): encode functions in tables (#592)
This commit is contained in:
@@ -17,7 +17,11 @@ local levelPrefixes = {
|
|||||||
|
|
||||||
local resourcePrintLevel = printLevel[GetConvar('ox:printlevel:' .. cache.resource, GetConvar('ox:printlevel', 'info'))]
|
local resourcePrintLevel = printLevel[GetConvar('ox:printlevel:' .. cache.resource, GetConvar('ox:printlevel', 'info'))]
|
||||||
local template = ('^5[%s] %%s %%s^7'):format(cache.resource)
|
local template = ('^5[%s] %%s %%s^7'):format(cache.resource)
|
||||||
local jsonOptions = { sort_keys = true, indent = true }
|
local function handleException(reason, value)
|
||||||
|
if type(value) == 'function' then return tostring(value) end
|
||||||
|
return reason
|
||||||
|
end
|
||||||
|
local jsonOptions = { sort_keys = true, indent = true, exception = handleException }
|
||||||
|
|
||||||
---Prints to console conditionally based on what ox:printlevel is.
|
---Prints to console conditionally based on what ox:printlevel is.
|
||||||
---Any print with a level more severe will also print. If ox:printlevel is info, then warn and error prints will appear as well, but debug prints will not.
|
---Any print with a level more severe will also print. If ox:printlevel is info, then warn and error prints will appear as well, but debug prints will not.
|
||||||
|
|||||||
Reference in New Issue
Block a user