Skip to content

Combine split tool warning logs into a single line - #845

Merged
ptr727 merged 9 commits into
developfrom
fix/combine-tool-warning-logs
Jul 16, 2026
Merged

Combine split tool warning logs into a single line#845
ptr727 merged 9 commits into
developfrom
fix/combine-tool-warning-logs

Conversation

@ptr727

@ptr727 ptr727 commented Jul 15, 2026

Copy link
Copy Markdown
Owner

The three media-info readers (FfProbe, MkvMerge, MediaInfo) logged Warning getting media info and the raw tool stderr as two separate log lines. Fold each into a single line with the stderr passed through CleanForLog (joined with |, control characters dropped) and the file name last, matching how tool errors are already logged elsewhere in the codebase. Also merge the two-line Linux folder-tools advisory in Tools.cs into one.

No behaviour change, log formatting only.

🤖 Generated with Claude Code

The three media-info readers logged "Warning getting media info" and the
raw tool stderr as two separate lines. Fold them into one line with the
stderr passed through CleanForLog (joined with " | ", control characters
dropped) and the file name last, matching how tool errors are logged
elsewhere. Likewise merge the two-line Linux folder-tools advisory into
one.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 15, 2026 16:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refines log formatting in PlexCleaner by consolidating split stderr warning logs from media-info readers into a single structured Serilog line (with stderr normalized via CleanForLog), and by combining the Linux folder-tools advisory into one log message.

Changes:

  • Combine Warning getting media info + raw stderr warning logs into a single Log.Warning line in FfProbeTool, MediaInfoTool, and MkvMergeTool.
  • Normalize tool stderr in those warnings using CleanForLog to keep multi-line output to a single structured value.
  • Merge the two Linux folder-tools advisory warnings in Tools.VerifyTools() into one warning message.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
PlexCleaner/Tools.cs Combines two Linux folder-tools advisory warnings into a single warning line.
PlexCleaner/MkvMergeTool.cs Consolidates media-info stderr warning logging into a single structured warning line.
PlexCleaner/MediaInfoTool.cs Consolidates media-info stderr warning logging into a single structured warning line.
PlexCleaner/FfProbeTool.cs Consolidates media-info stderr warning logging into a single structured warning line.

Comment thread PlexCleaner/MkvMergeTool.cs Outdated
Comment thread PlexCleaner/MediaInfoTool.cs Outdated
Comment thread PlexCleaner/FfProbeTool.cs Outdated
Capture and log tool error output for troubleshooting on a single line
with the exit code, operation, and file name:

- LogFailedResult takes the file name and logs the tool's error output,
  read from the stream the tool uses (stderr for the ffmpeg family and
  HandBrake, stdout for the mkvtoolnix tools and MediaInfo) with a
  fallback to the other captured stream so it is never lost. All tools
  now run buffered so output is always captured, fixing mkvpropedit and
  7-Zip failures that logged no error text; the unused non-buffered
  Execute overload is removed.
- Execute, its cancellation path, and LogFailedResult record the calling
  method as the operation via CallerMemberName, so a command ties to its
  purpose in a parallel log without correlating separate lines.
- Removed per-method debug lines that only restated the command already
  logged by Execute, and the dead mkvmerge stderr warning branch.

Move the Serilog import to a global using, and document the tool error
streams and the failure-handling philosophy in AGENTS.md and the
logging, DTS escalation, and idet parse changes in HISTORY.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 15, 2026 18:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 2 comments.

Comment thread AGENTS.md Outdated
Comment thread HISTORY.md Outdated
Address review feedback:
- The media-info warning path logged an empty "{Warning}" segment when
  stderr held only whitespace; clean the output first and log only when
  it is non-empty.
- AGENTS.md and HISTORY.md overstated the logging: output is consumed
  either buffered (Execute) or streamed (ExecuteStreamStdErr for the
  -f null verify), not "always buffered"; the mkvtoolnix tools override
  GetErrorOutput to stdout while MediaInfo's stdout errors are caught by
  the LogFailedResult fallback; 7-Zip errors are on stderr.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 15, 2026 18:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 3 comments.

Comment thread PlexCleaner/FfProbeTool.cs
Comment thread PlexCleaner/FfProbeTool.cs
Comment thread HISTORY.md
Address review feedback:
- GetClosedCaptions and GetStreamTimings logged a "Failed to get ..."
  line in addition to LogFailedResult, which now carries the operation;
  remove the extra line so a failure is one structured line.
- Scope the HISTORY note to the buffered mkvpropedit and 7-Zip
  executions rather than claiming all tool output is captured.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 15, 2026 18:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 1 comment.

Comment thread PlexCleaner/MediaTool.cs Outdated
Read both captured streams once and pick the tool's declared stream
(GetErrorOutput), else the other non-empty stream, so the fallback no
longer re-reads the primary stream and matches the documented intent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 15, 2026 18:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 1 comment.

Comment thread PlexCleaner/IProcessPlugin.cs Outdated
Copilot AI review requested due to automatic review settings July 15, 2026 18:35
IProcessPlugin.Logger is part of the public plugin contract, and a bare
ILogger is ambiguous with Microsoft.Extensions.Logging.ILogger. Restore
the fully qualified Serilog.ILogger and suppress the simplify-name
analyzer with an attribute (not a pragma) so the public interface is
unambiguous to plugin authors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ptr727
ptr727 force-pushed the fix/combine-tool-warning-logs branch from 913c956 to 88d6143 Compare July 15, 2026 18:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 1 comment.

Comment thread PlexCleaner/Tools.cs
Copilot AI review requested due to automatic review settings July 15, 2026 18:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 1 comment.

Comment thread PlexCleaner/MkvMergeTool.cs Outdated
- Use a semicolon in the Linux folder-tools advisory instead of a comma
  splice.
- MergeToMkv logged the output temp path as the file name; log the
  primary source instead, consistent with the other mkvmerge operations.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 15, 2026 18:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 1 comment.

Comment thread AGENTS.md
The Debug level definition listed "Getting media info" as an example,
contradicting the new guidance not to add a per-method debug line that
restates the command; drop it and show the operation in the command
example instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 15, 2026 18:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 1 comment.

Comment thread PlexCleaner/Tools.cs
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 15, 2026 18:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated no new comments.

@ptr727
ptr727 merged commit fb6cd8a into develop Jul 16, 2026
15 checks passed
@ptr727
ptr727 deleted the fix/combine-tool-warning-logs branch July 16, 2026 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants