-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: ox_lib update to version 3.10.1
- Loading branch information
1 parent
c92c96d
commit a2964cb
Showing
10 changed files
with
119 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
server-data/resources/[ox]/ox_lib/imports/print/shared.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
---@enum PrintLevel | ||
local printLevel = { | ||
error = 1, | ||
warn = 2, | ||
info = 3, | ||
verbose = 4, | ||
debug = 5, | ||
} | ||
|
||
local levelPrefixes = { | ||
'^1[ERROR]', | ||
'^3[WARN]', | ||
'^7[INFO]', | ||
'^4[VERBOSE]', | ||
'^6[DEBUG]', | ||
} | ||
|
||
local resourcePrintLevel = printLevel[GetConvar('ox:printlevel:' .. cache.resource, GetConvar('ox:printlevel', 'info'))] | ||
local template = ('^5[%s] %%s %%s^7'):format(cache.resource) | ||
local jsonOptions = { sort_keys = true, indent = true } | ||
|
||
---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. | ||
---@param level PrintLevel | ||
---@param ... any | ||
local function libPrint(level, ...) | ||
if level > resourcePrintLevel then return end | ||
|
||
local args = { ... } | ||
|
||
for i = 1, #args do | ||
local arg = args[i] | ||
args[i] = type(arg) == 'table' and json.encode(arg, jsonOptions) or tostring(arg) | ||
end | ||
|
||
print(template:format(levelPrefixes[level], table.concat(args, '\t'))) | ||
end | ||
|
||
lib.print = { | ||
error = function(...) libPrint(printLevel.error, ...) end, | ||
warn = function(...) libPrint(printLevel.warn, ...) end, | ||
info = function(...) libPrint(printLevel.info, ...) end, | ||
verbose = function(...) libPrint(printLevel.verbose, ...) end, | ||
debug = function(...) libPrint(printLevel.debug, ...) end, | ||
} | ||
|
||
return lib.print |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...ox_lib/web/build/assets/index-c23fc323.js → ...ox_lib/web/build/assets/index-6e94cd7b.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters