Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposals for new version #1

Open
ivanseidel opened this issue Mar 8, 2017 · 1 comment
Open

Proposals for new version #1

ivanseidel opened this issue Mar 8, 2017 · 1 comment

Comments

@ivanseidel
Copy link
Owner

ivanseidel commented Mar 8, 2017

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

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();
@vajahath
Copy link

vajahath commented Jul 3, 2017

Looks like we need an even simpler api.
What do you think if we can make functions like

  • progress()
  • loading()
  • queue()
  • etc

which are the wrappers around the examples ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants