Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[talker_dio_logger] Colored log by status code #364

@cardinal1994

Description

@cardinal1994

When using the logger, I encountered the problem of not being able to change the color of the log depending on the status of the code or custom instance.

I suggest the following solutions:

  1. transmit to the interceptor Map<int, Color> what is statusCode and Color
    but I don't think anyone will color each status code separately. Therefore:
  2. I suggest adding status code groups to the existing map. That is, 2xx, 3xx, 4xx, 5xx. This will allow you to color individual groups of status codes in the required color, and the dio error will remain a separate map parameter, since we do not receive a status code with it.

Additionally. There are different architecture options and we do not always have a good backend or architecture of the project that we got. For example, if we receive a field validation error with status code 200, then according to the logic specified above, it will be drawn in the color that corresponds to 200 (and this is probably logical, I would say write good code). However, there are options to create your own color groups. That is, regardless of the logic of any of the architectures, the user will be able to create their own color group. This is an idea to think about in the future because it is difficult to imagine the implementation yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestopen-to-contributionYou can open Pull-request to resolve this issuetalker_dio_loggerRelated to talker_dio_logger packagetalker_http_loggerRelated to talker_http_logger package

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions