pingcap / pingcap/tiup

Refactor (console & log) output framework

Open
#1,208 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

component/cluster component/dm component/tiup difficulty/hard help wanted type/enhancement type/feature-request
Dominant language
Go
Stars
466
Forks
338
Avg merge
3d 7h
Merged PRs (30d)
8

Description

Feature Request

Is your feature request related to a problem? Please describe:

At the moment, we use several different packages to output information (both to console and to audit log files), this makes it hard to maintain and change if we need to update the TUI.

Describe the feature you'd like:

Sort out all outputs we use now and migrate them to one, unified output framework. I'd prefer to refactor pkg/logger to a wrapped zap logger, and all outputs are ported to use the customized logger instead of pure zap logger nor fmt.

The refactor work itself should NOT change any current TUI much (except necessary minor adjustments), we'll do that in other PRs, to avoid this work being too complex.

And be noted that changing audit log format is critical as it may broke the replay function.

Teachability, Documentation, Adoption, Migration Strategy:

Most of the codes related are in cluster and dm, and many many codes are using fmt to format console outputs. And we need to make sure things don't mess up when the messages has colored string in them.

I'd like to make pkg/logger the all-in-one output gateway of all components, and when the command is called, a multi target logger is initialized to output messages both to audit log and to console. They may be in different format (e.g., write JSON to audit log, and write formatted text to console), and the log level could be customized.

More details should be added once someone is willing to work on this and start to dig into the code.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting pkg/logger and inventorying output paths in cluster and dm, including uses of fmt and zap. Check how audit logs are consumed by replay and identify the current console and audit formats. Done means the relevant outputs use the unified logger without unnecessary TUI changes, while preserving audit-log compatibility.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
observability, tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.