Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

refactor the crate to separate the provided configurable formater and the optional custom formatter

オープン
#365 コメント 10 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
静か
技術スタック
rust

調査の方向性

まず、issue で説明されている Builder API と Logger API をたどり、fmt::Builder とカスタムフォーマッタのパスを含めて確認します。現在のフォーマッタオプションを、提案されている build_with_custom_formatter と config_builder の設計と比較します。設定可能なフォーマッタがカスタムフォーマットから分離され、現在の API の不自然さがなくなれば完了です。

索引モデルが issue の本文から書いたものです。

説明

This crate does three things:

  1. It parses environment variables into a verbosity configuration for individual modules (Env)
  2. It filters log messages against said configuration (Logger.filter)
  3. It provides a configurable formater (Logger.format)

You will generally read en environment, convert it to a filter and then combine the filter and a formater into a Logger which you install as default logger.

Technically all three are usable in isolation.
In practice almost everybody is using 2., most people will be using 1. with slight modifications to the default logging level, for example using verbosity flags in clis.

3 is the most commonly exchanged. This is reflected by the builder giving you the option of providing a custom formater.

This functionality should be moved to the Logger. If you want a custom formater you do not interact with the provided configurable formater in any way, but are still forced to use the type to create a Logger.

The current behaviour increases the internal complexity of the Builder struct and leads to weird api crincles. For example after calling Builder.format(|my| fn) technically every try to modify the configurable formatter (ex. format_level) should panic, as that is programmer error (unless ofc it is followed by a call to default_format).

This issue proposes to create a build_with_custom_formatter function instead. This would allow fmt::Builder to be retired.

Also since 90% of the api on the Builder is formatter options a single fn config_builder(|f: formatter|) could reduce duplication.

主要言語
Rust
スター
1.1k
フォーク
150
平均マージ
3分
マージ済み PR(30日)
2

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rust-cli/env_logger のほかの issue

rust-cli/env_logger の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。