用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/emavgl/oinkoin --skill logging命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | logging |
| description | Adds consistent, context-aware Talker logging for important Oinkoin operations, diagnostics, warnings, and exceptions. |
| argument-hint | [operation-or-file] |
Use the project logger in lib/services/logger.dart for important application operations. Logs are shown through the global Talker instance and are available in the in-app LogScreen.
For a static service or class, use the actual project API:
class ExampleService {
static final _logger = Logger.withContext('ExampleService');
static Future<void> run() async {
_logger.info('Starting operation');
}
}
For an instance class:
final _logger = Logger.withClass(ExampleService);
Use a stable, useful context. Do not create a context for every individual method.
info — important operations and milestonesUse info for events that explain the normal high-level flow:
Examples:
_logger.info('Starting portable preference restore (12 entries)');
_logger.info('Portable preference restore completed: 10 restored, 1 unknown, 1 invalid, 0 errors');
debug — detailed diagnosticsUse debug for details useful while diagnosing behavior but too noisy for normal high-level reporting:
Examples:
_logger.debug('Restored preference: $key');
_logger.debug('No restored custom currency configuration to load');
warning — recoverable unexpected conditionsUse warning when the application can safely continue:
_logger.warning('Skipping unknown preference from backup: $key');
error / critical — failuresUse error for an operation failure that is handled, and critical only for severe failures requiring urgent attention. For caught exceptions, prefer handle so the exception and stack trace are retained:
try {
await operation();
} catch (error, stackTrace) {
_logger.handle(error, stackTrace, 'Failed to complete operation: $operationName');
}
Do not log only error.toString() when a stack trace is available.
For a non-trivial operation:
info message when it starts.debug level.warning level.handle with the stack trace.info completion summary with counts/outcome.Each item in a batch should not abort the entire batch merely because one item failed. Isolate the item in try/catch, log the key/identifier and exception, and continue when safe.
Never log:
Log safe metadata instead:
For backup preferences, log restored, unknown, invalid, and errors counts, but never the setting values.
info for every loop item.print for application diagnostics; use Logger.When adding logging:
flutter analyze on changed files.基于 SOC 职业分类