Skip to content

feat: add custom printFn to options#238

Closed
SaadBazaz wants to merge 1 commit intosindresorhus:mainfrom
SaadBazaz:patch-1
Closed

feat: add custom printFn to options#238
SaadBazaz wants to merge 1 commit intosindresorhus:mainfrom
SaadBazaz:patch-1

Conversation

@SaadBazaz
Copy link
Copy Markdown

Hey, thanks for the great library.

In some cases as ours, we may not want unnecessary console.errors as we use them to write to a special error log.

We don't consider an older version an "error", we consider it "info"-level logging category.

I'm not sure how to add types in this repo, if anyone could guide I'd appreciate it.

@sindresorhus
Copy link
Copy Markdown
Owner

Thanks for the PR, but I'm declining this.

console.error doesn't mean "this is an error" — it just means "write to stderr". Update notifications belong on stderr (not stdout) to avoid polluting data output when piping. This is standard Unix convention for CLI tools.

If you don't want these notifications, you can:

  • Set the NO_UPDATE_NOTIFIER environment variable
  • Check notifier.update yourself and log however you want
  • Override console.error in your logging framework

Adding a printFn option adds API complexity for something that can be handled at the application level.


Sidenote: Your logger should not assume console.error means error. That's the wrong semantics.

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

Successfully merging this pull request may close these issues.

2 participants