Ability to control other options programatically
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 38/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript
- Área
- developer-experience
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- JavaScript
- Estrellas
- 11.5k
- Forks
- 992
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de debug-js/debug
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
-
Debug as JSON Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
console.group and groupCollapsed Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 28/100
Todos los issues de debug-js/debug
Issues similares
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
apache/cloudstack#14222 ·
-
Browser Waiting for: Product Owner
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
getsentry/sentry-javascript#24577 · 1 comentario ·
-
curation good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
amponce/archive-movie-browser#186 ·
-
light
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
aemdemos/patients-stryker#253 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
clerk/javascript#9852 ·