Skip to content

Add option to not log to console #125

@timomeh

Description

@timomeh

First of all: I love this library. ❤️

Current situation

Failed queryFns will be catched and then logged to the console with console.error.

Problem

I'm using react-query with React Native, which shows all console.error as a big red box in development mode. I expect that some of my requests can throw an error (e.g. if it's an 401 Unauthorized). But even if I'm expecting and handling those errors, they will appear as big red box because it has been logged with console.error.

image

I could also imagine that when I'm using react-query inside the browser, I maybe don't want errors to be logged to the console.

Current workaround

I'm currently overriding console.error to ignore all those errors. 🙈

Proposed solution

Maybe logging could be an opt-out? Or opt-in, like a global debug mode?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions