ivanseidel / ivanseidel/node-draftlog

Proposals for new version

Offen
#1 1 Kommentar 6 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
JavaScript
Sterne
1.2k
Forks
33
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

`DraftLog` works. The API is simple. I want to keep it that way, but it might be improved with a few ideas.

Please, contribute by giving your insights, ideas and so on.

### `[1]` Avoid overriding `console._stdout`
Can we find a way to NOT put something in the middle of the Stream? Is it possible to 'listen' to data on a Writable stream? If so, that's all we need (we don't ever modify contents anyway)

### `[2]` Should we 'hook' draft method into `console`?
Hooking into console is really cool, but... To specific.

What if the person doesn't uses `console` to do logging, but writing to `stdout` directly?
In that case, it would cause two problems:

1. Draft method would be available only through custom instantiated `Console`. That's a bad requirement to ask developers... (Console is cool, but not a requirement for logging stuff)
2. If any data get's logged directly into `stdout`, then it would not capture that data. `[1]` would fix that, if just in listening mode.

### `[3]` Ideas for a new (and simpler) API

```javascript
const DraftLog = require('draftlog')
console.draft = DraftLog(process.stdout[, process.stdin])
// Or save to a custom function maybe
const draft = DraftLog(process.stdout[, process.stdin])

// Would make things easier in case of disabling:
if (PRODUCTION)
const draft = DraftLog();
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Das Issue nennt keine Dateien oder Tests; beginne mit der Überprüfung der aktuellen API von DraftLog und der Verarbeitung von console- und stdout-Streams. Vergleiche die vorgeschlagenen Optionen zum Abhören von Streams und zur API und kläre anschließend, welches Design implementiert werden soll. Als abgeschlossen gilt die Aufgabe, wenn ein abgestimmter Vorschlag mit definiertem Verhalten für console, direktes stdout-Logging und die Deaktivierung vorliegt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, node.js
Bereich
cli
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
20/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.