aternos/sherlock
Composer 安装命令:
composer require aternos/sherlock
包简介
PHP library to apply minecraft mappings to log files
README 文档
README
About
Sherlock is a PHP library that investigates obscure Minecraft logs and makes them more readable by replacing obfuscated stacktraces with useful names using Mappings provided by Mojang (or FabricMC).
Installation
composer require aternos/sherlock
Usage
Getting an Obfuscation Map
To process a log you need the correct Obfuscation Map. You can get the url of a Vanilla Obfuscation Map for any Minecraft version (including snapshots) using the LauncherMetaMapLocator:
$url = new \Aternos\Sherlock\MapLocator\LauncherMetaMapLocator("1.18.2-pre1", "server"); $map = new \Aternos\Sherlock\Maps\URLVanillaObfuscationMap($url)
The second parameter in this example is the mapping type. Mojang releases both server and client Obfuscation Maps, so you will have to pick the one that matches your environment.
Fabric
Fabric logs are already mapped from Vanilla's obfuscated names to Intermediary. These are different mappings that aim to keep names consistent across multiple versions. To process such a log you need the corresponding Yarn mappings. You can get the URL to a gzip map file from the Fabric Maven repository like this:
$url = new \Aternos\Sherlock\MapLocator\FabricMavenMapLocator("1.18.2-pre1"); $map = new \Aternos\Sherlock\Maps\GZURLYarnMap($url);
Yarn mappings are not environment dependent since Intermediary already takes care of the differences.
Caching Map contents
When you have created an Obfuscation Map you can get the raw content using the getContent() method. You can cache that to reduce requests to the APIs that are used to retrieve them. When you want to create an Obfuscation Map from a string directly you can create an instance of VanillaObfuscationMap and YarnMap directly.
Remapping a log using the Obfuscation Map
$log = new \Aternos\Sherlock\ObfuscatedString(file_get_contents("test.log"), $map); $remappedContent = $log->getMappedContent(); file_put_contents("test.mapped.log", $remappedContent)
The content will only be mapped once you try to retrieve it and will be stored from then on.
aternos/sherlock 适用场景与选型建议
aternos/sherlock 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 415 次下载、GitHub Stars 达 4, 最近一次更新时间为 2022 年 03 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 aternos/sherlock 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 aternos/sherlock 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 415
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-03-29