create-logger
БесплатноБез исполняемых скриптовНе проверенGuides creation of custom loggers for Simple History. Use when building a new logger class to log WordPress events.
от bonny★ 315 звёзд на GitHubОб этом скилле
Creating a Custom Logger
Step-by-step guide for building a logger that hooks into WordPress actions/filters and logs events to Simple History.
Architecture Overview
WordPress hook fires
-> Logger::loaded() registers callback
-> Callback builds context array
-> $this->info_message('message_key', $context)
-> Stored in DB with logger slug + message key
-> get_log_row_details_output() formats for display
Step 1: Create the Logger Class
Create a PHP file in loggers/ following the naming convention class-{name}-logger.php.
Minimal Boilerplate
<?php
namespace Simple_History\Loggers;
use Simple_History\Log_Initiators;
/**
* Logs [description of what this logger tracks].
*/
class My_Feature_Logger extends Logger {
/** @var string Logger slug, max 30 characters, stored in DB. */
public $slug = 'MyFeatureLogger';
/**
* Return logger info.
*
* @return array
*/
public function get_info() {
return array(
'name' => _x( 'My Feature Logger', 'MyFeatureLogger', 'simple-history' ),
'description' => __( 'Logs changes to my feature', 'simple-history' ),
'capability' => 'manage_options',
'messages' => array(
'feature_created' => __( 'Created feature "{feature_name}"', 'simple-history' ),
'feature_updated' => __( 'Updated feature "{feature_name}"', 'simple-history' ),
'feature_deleted' => __( 'Deleted feature "{feature_name}"', 'simple-history' ),
),
'labels' => array(
'search' => array(
'label' => _x( 'My Feature', 'My Feature logger: search', 'simple-history' ),
'label_all' => _x( 'All my feature changes', 'My Feature logger: search', 'simple-history' ),
'options' => array(
_x( 'Created', 'My Feature logger: search', 'simple-history' ) => array(
'feature_created',
),
_x( 'Updated', 'My Feature logger: search', 'simple-history' ) => array(
'feature_updated',
),
_x( 'Deleted', 'My Feature logger: search', 'simple-history' ) => array(
'feature_deleted',
),
),
),
),
);
}
/**
* Called when logger is loaded. Hook into WordPress here.
*/
public function loaded() {
add_action( 'save_post', array( $this, 'on_save_post' ), 10, 3 );
}
/**
* Handle the WordPress hook.
*
* @param int $post_id Post ID.
* @param \WP_Post $post Post object.
* @param bool $update Whether this is an update.
*/
public function on_save_post( $post_id, $post, $update ) {
$context = array(
'feature_name' => $post->post_title,
'feature_id' => $post_id,
);
if ( $update ) {
$this->info_message( 'feature_updated', $context );
} else {
$this->info_message( 'feature_created', $context );
}
}
}
Step 2: Key Properties and Methods
The $slug Property
- Required. Max 30 characters.
- Stored in the database to associate log rows with this logger.
- Use PascalCase by convention (e.g.,
PluginLogger,SiteHealthLogger). - Once in production, never change it -- existing log entries would become orphaned.
The get_info() Method
Required keys:
| Key | Type | Description |
|---|---|---|
name |
string | Human-readable logger name (translated) |
description |
string | What this logger tracks (translated) |
messages |
array | Message key => template string pairs |
capability |
string | Required capability to view logs (default: manage_options) |
labels |
array | Search/filter labels for the GUI |
Optional keys:
| Key | Type | Description |
|---|---|---|
type |
string | 'core' for built-in loggers, omit for custom |
The loaded() Method
This is where you hook into WordPress actions and filters. Called once when Simple History loads the logger.
Message Templates
Use {context_key} placeholders in message strings. They are automatically replaced with values from the context array.
'messages' => array(
// {plugin_name} is replaced with $context['plugin_name']
'plugin_activated' => __( 'Activated plugin "{plugin_name}"', 'simple-history' ),
),
Message Key Uni
Установить create-logger в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobBashEditWriteFAQ
Что делает скилл create-logger?
Guides creation of custom loggers for Simple History. Use when building a new logger class to log WordPress events.
Как установить скилл create-logger?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл create-logger запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic