ivanseidel / ivanseidel/node-draftlog

Proposals for new version

Open
#1 1 comment 6 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.2k
Forks
33
PR merge metrics
No merged PRs in 30d

Description

`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();
```

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names no files or tests; start by reviewing DraftLog's current API and its handling of console and stdout streams. Compare the proposed stream-listening and API options, then clarify which design should be implemented. Done requires an agreed proposal with defined behavior for console, direct stdout logging, and disabling.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli
Issue type
Feature
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.