Automattic / Automattic/syndication

Dead code: Option storage in Syndication_Logger is unreachable

Open
#177 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
107
Forks
44
Avg merge
18m
Merged PRs (30d)
19

Description

## Summary

The `Syndication_Logger` class has an option storage code path (lines 347-377) that is unreachable through the public API.

## Background

PR #53 (2015) introduced the logging framework with two storage types:
- `object` - stores logs in post meta (implemented and used)
- `option` - stores logs in WP options (implemented but unreachable)

The error message at line 300 references a `log_option` method:
> "You need to provide a valid post_id or use log_option instead"

However, `log_option()` was never implemented. All public methods hardcode `storage_type = 'object'`:
- `log_post_error()` → `log_post()` → `log('object', ...)`
- `log_post_success()` → `log_post()` → `log('object', ...)`
- `log_post_info()` → `log_post()` → `log('object', ...)`

## Recommendation

Either:
1. **Remove the dead code** - Delete the option storage branch (lines 347-377) and update the error message
2. **Implement the feature** - Add `log_option_error()`, `log_option_success()`, `log_option_info()` methods if there's a use case

Option 1 is recommended unless there's a known need for option-based logging.

## Related

- PR #53 introduced this code
- Issues #20 and #45 were the original drivers for the logging framework

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in the Syndication_Logger class at the error message around line 300 and the option-storage branch around lines 347-377, then trace log_post() and the log_post_error(), log_post_success(), and log_post_info() entry points. Confirm that no public API reaches option storage, then remove the unreachable branch and update the message, or document the use case before choosing the alternative implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.