Ability to control other options programatically
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 38/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript
調査の方向性
Start by reading the existing initialization and enable paths, including the handling of process.env and browser localStorage described in the issue. Done means a callable debug.init() can re-read the relevant environment configuration, including DEBUG_COLORS, after dotenv.config() or equivalent setup without requiring a reload.
索引モデルが issue の本文から書いたものです。
説明
I use the package dotenv and the dotenv.config(); function to load my config from a .env file. I would like my default .env file to contain the config:
DEBUG=my-app:*,-my-app:verbose*
DEBUG_COLORS=1
So that developers, with the default .env file will have a good experience.
I have found that I can get debug to honor my DEBUG environment variable with this snippet of code in my config file:
dotenv.config();
const DEBUG: false | string = process.env.DEBUG && process.env.DEBUG !== 'false' ? process.env.DEBUG : false;
if (isString(DEBUG) && DEBUG !== 'false') {
console.error(colors.yellow(`🐞 enabling debug outout for: "${DEBUG}". You can edit, or disable this in the .env file`));
Debug.enable(DEBUG);
}
but as far as I can tell, there is no way to get debug to switch the DEBUG_COLORS config over–once the package initializes and reads it from process.env, that's it. Unfortunately this doesn't work in this case.
Request: add a debug.init() method that can be called to re-read all of the environment configs–this way, once I know my environment is setup correctly, I can call debug.init and trust things will work.
I have run into the same exact issue with the debug package in the browser, though I did not know about debug.enableat the time. This point is moot, just wanted to provide it to share some insights with how I'm using it.
I have some FE code that says:
if (environment.local && !localStorage.debug) {
localStorage.debug = '...';
console.warn(`debug initialized–reload your browser and enable verbose logging in the console to see the output`);
}
In the front end case, I need to ship a change that uses debug.enable, and override the log to use console.log, and that will let me improve the experience.
- 主要言語
- JavaScript
- スター
- 11.5k
- フォーク
- 992
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
debug-js/debug のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
-
Debug as JSON オープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 28/100
似ている issue
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
githubnext/gh-aw-workshop#3692 ·
-
agent/guide documentation hive/hosted-available-lke648397-260827-5n31
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
-
Add: BuyPass TV オープンchannels:add check:passed
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
S: triage
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100