29 lines
2.1 KiB
Mcfunction
29 lines
2.1 KiB
Mcfunction
# 调用者:#fz:logger/init
|
||
##### 使用方式,形如:tellraw @a [{"nbt": "fz.exception.load_without_install_exception", "interpret": true, "storage": "fz:logger"}, {"text": "计分板"}]
|
||
|
||
## 前缀
|
||
### 根
|
||
data modify storage fz:logger fz.root set value '[{"text": "", "color": "white"}, {"text": "[", "color": "dark_gray"}, {"text": "FZD", "color": "gold"}, {"text": "]", "color": "dark_gray"}]'
|
||
### 不同日志等级
|
||
#### error 800
|
||
data modify storage fz:logger fz.level.error set value '[{"text": "", "color": "red"}, {"nbt": "root", "interpret": true, "storage": "fz:logger"}, {"text": "[错误]"}]'
|
||
#### alert 600
|
||
data modify storage fz:logger fz.level.alert set value '[{"text": "", "color": "yellow"}, {"nbt": "fz.root", "interpret": true, "storage": "fz:logger"}, {"text": "[提醒]"}]'
|
||
#### info 500
|
||
data modify storage fz:logger fz.level.info set value '[{"text": "", "color": "green"}, {"nbt": "fz.root", "interpret": true, "storage": "fz:logger"}, {"text": "[信息]"}]'
|
||
#### debug 400
|
||
data modify storage fz:logger fz.level.debug set value '[{"text": "", "color": "dark_aqua"}, {"nbt": "fz.root", "interpret": true, "storage": "fz:logger"}, {"text": "[调试]"}]'
|
||
#### fine 300
|
||
data modify storage fz:logger fz.level.fine set value '[{"text": "", "color": "gray"}, {"nbt": "fz.root", "interpret": true, "storage": "fz:logger"}, {"text": "[详细]"}]'
|
||
|
||
## 异常
|
||
data modify storage fz:logger fz.exception.load_without_install_exception set value '[{"nbt": "fz.level.error", "interpret": true, "storage": "fz:logger"}, {"text": "模块在未安装时被加载:"}]'
|
||
|
||
## 第一次安装时日志等级默认为一般消息
|
||
execute unless data storage fz:logger fz.levels.current run data modify storage fz:logger fz.levels.current set value 500
|
||
|
||
## 读取debug等级存入缓存
|
||
execute store result score fz.logger.level fz.variable.integer run data get storage fz:logger fz.levels.current
|
||
|
||
## 调试
|
||
execute if score fz.logger.level fz.variable.integer matches ..500 run tellraw @a [{"nbt": "fz.level.info", "interpret": true, "storage": "fz:logger"}, {"text": "已初始化系统组件:日志"}] |