vault backup: 2025-03-28 11:00:46

Affected files:
.obsidian/workspace.json
Management/Development and Configuration/Datapack/Logging.md
This commit is contained in:
ehrumsey 2025-03-28 11:00:46 -05:00
parent 03278b68fa
commit f6533fec78
2 changed files with 48 additions and 3 deletions

View File

@ -97,12 +97,12 @@
"state": { "state": {
"type": "markdown", "type": "markdown",
"state": { "state": {
"file": "Management/User and Admin/Unified Metrics.md", "file": "Management/Development and Configuration/Datapack/Logging.md",
"mode": "source", "mode": "source",
"source": false "source": false
}, },
"icon": "lucide-file", "icon": "lucide-file",
"title": "Unified Metrics" "title": "Logging"
} }
} }
], ],
@ -266,6 +266,9 @@
}, },
"active": "f26c718e97d69090", "active": "f26c718e97d69090",
"lastOpenFiles": [ "lastOpenFiles": [
"Management/User and Admin/Unified Metrics.md",
"Management/Development and Configuration/Datapack/Logging.md",
"Management/Development and Configuration/Datapack",
"Management/User and Admin/Player Analytics (PLAN).md", "Management/User and Admin/Player Analytics (PLAN).md",
"Management/User and Admin/Ferdinland Website.md", "Management/User and Admin/Ferdinland Website.md",
"Management/User and Admin/Ferdinland Lore Site.md", "Management/User and Admin/Ferdinland Lore Site.md",
@ -274,7 +277,6 @@
"Management/index.md", "Management/index.md",
"index.md", "index.md",
"users", "users",
"Management/User and Admin/Unified Metrics.md",
"Management/Development and Configuration", "Management/Development and Configuration",
"Management/Operations and Infrastructure", "Management/Operations and Infrastructure",
"Management/User and Admin", "Management/User and Admin",

View File

@ -0,0 +1,43 @@
# Usage
## Log Levels
This module has 5 log levels:
- `FATAL`: (5) Indicates that at least an entire module will need to shut down. Generally indicates the likelihood of data corruption.
- `ERROR`: (4) The requested operation could not be completed, or some other problem that prevents necessary or requested functions from working as intended.
- `WARNING`: (3) Something has or may have gone wrong, but nothing has been prevented from functioning. Warnings should be investigated, but do not require immediate action.
- `INFO`: (2) Informational log ("Did this thing", "Started this process"). Shouldn't be too detailed.
- `DEBUG`: (1) Granular play-by-play useful for troubleshooting errors. More likely to include detailed `body`.
By default, only levels 3 and up will be output. Debug logging, which displays all levels, can be manually toggled in-game with `function ferdinland:logger/toggle`.
Each log level has an associated test function which will output:
```
[<LOG_LEVEL>]: (logger) This is a test
```
The functions are:
- `ferdinland:logger/test_fatal`
- `ferdinland:logger/test_error`
- `ferdinland:logger/test_warning`
- `ferdinland:logger/test_info`
- `ferdinland:logger/test_debug`
## Syntax
The module uses the following syntax:
```ts
logger(type, caller, message, body)
```
`type` takes an integer from `1` to `5`, corresponding to the associated log level.
`caller` takes an unquoted string. This should reflect the function triggering the log message: `module.path.to.function`.
`message` takes a quoted string or an NBT storage location. NBT storage should be in standard JMC format (`::path.to.element`). *Only* paths beginning with `::` with be processed as storages. `@e[tag=entity]::path.to.element` will be processed as a string.
The content of `message` will be output in a `say` command, and will be visible in the server console.
`body` takes a `tellraw` object. It will be output in the command `tellraw @ <body>`.
# Configuring
The log level is set to `3` by default. This can be changed manually in game with the command where `<int>` is replaced with the desired log level:
```vb
scoreboard players set $log_level __variable__ <int>
```