-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Steps, Tabs, Tab } from 'nextra-theme-docs'; | ||
|
||
# Shared | ||
|
||
Prints to console conditionally based on convars set. | ||
Different level prints are colored and labeled. | ||
Resource name is always included. | ||
|
||
## lib.print | ||
|
||
```lua | ||
lib.print.error(...) | ||
lib.print.warn(...) | ||
lib.print.info(...) | ||
lib.print.verbose(...) | ||
lib.print.debug(...) | ||
``` | ||
|
||
- vararg: `any` | ||
- What to print in console. Converts tables into a pretty-print format. | ||
|
||
### Example | ||
|
||
```lua | ||
lib.print.warn("query latency high: ", latency) | ||
``` | ||
|
||
### Levels | ||
|
||
- Error | ||
- Indicates a failure in the system. | ||
|
||
- Warn | ||
- Warns of an unexpected condition, or a state which is likely to cause an error in the future. | ||
|
||
- Info | ||
- Information about high-level, successful operations. | ||
|
||
- Verbose | ||
- More detailed information containing intermediate steps of high-level, operations | ||
|
||
- Debug | ||
- Used by developers to understand the system and may contain detailed trace information. | ||
Should generally not be turned on when not debugging. | ||
|
||
### Config | ||
Use the following convars to set your print level. Prints less severe than the current level will not be executed. | ||
For example, a level of info will print error, warn, and info, but not verbose nor debug. Defaults to info if not set. | ||
Resource specific print levels override the global convar. | ||
|
||
```bash | ||
set ox:printlevel "info" | ||
set ox:printlevel:ox_inventory "warn" | ||
set ox:printlevel:<resourceName> "<level>" | ||
``` |