Skip to content

Logs are colorized everywhere #60

@aldofunes

Description

@aldofunes

I am having some trouble with the colorizing of logs. Specifically, when logging to non-tty outputs.

There is an override in colorize.js:9 that prevents the colors package to enable or disable when supported.

First of all, I would like to know why this decision was made, and if it can be removed.

I have made a hack as a workaround. Here it is, in case anyone wants to know how to do it:

    format: format.combine(
      LOGGER_COLORS === 'true' ? format.colorize({ all: true }) : format(i => i)(),
      format.printf(({
        label = 'default',
        namespace = 'default',
        level = 'debug',
        message,
        timestamp,
      }) => {
        let string = `${label}:${namespace} ${level}: ${message}`;

        if (LOGGER_CONSOLE_TIMESTAMP === 'true') {
          string = `${timestamp} ${string}`;
        }

        return string;
      }),
    ),

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