Skip to content

Avoid doing console.error #333

Closed

Description

@satazor

This is not really a bug, nor a feature request, so I haven't followed any of the templates.

It seems console.error is being used in several situations, e.g.:

console.error(e.errors);
.

In most scenarios, these console.error calls are unnecessary as errors will be thrown anyway, that should be handled by devs consuming this library. In other situations, errors aren't thrown, and these messages are useful. However, most devs are using custom loggers (like JSON loggers), and would like to be able to customize the logging behavior.

Activity

  1. lance commented on Sep 2, 2020

    @lance
    Member

    Thanks @satazor for opening this issue. It actually looks like there are only two calls to console.error() - the one you pointed out, and this one

    console.error(`Unknown spec version ${version}. Default to ${Version.V1}`);

    I think probably the one you note is the only one that should be removed, as the one in src/messages/http is informational and an exception isn't thrown.

  2. satazor commented on Sep 2, 2020

    @satazor
    Author

    @lance 👍

    For informal logs, please consider adding the ability to specify the logger (maybe with the same interface as console), so that we can override with custom loggers.

  3. github-actions commented on Oct 3, 2020

    @github-actions
    Contributor

    This issue is stale because it has been open 30 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions