Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coloring issue with multiple loggers #941

Open
icebob opened this issue Jun 13, 2021 · 1 comment
Open

Coloring issue with multiple loggers #941

icebob opened this issue Jun 13, 2021 · 1 comment

Comments

@icebob
Copy link
Member

icebob commented Jun 13, 2021

Prerequisites

If you have multiple loggers and there is logger with formatted json or jsonext the coloring doesn't work well with Console logger. The problem is that both are using the same kleur.

Current Behavior

image

Expected Behavior

image

Failure Information

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. step 1
  2. step 2
  3. you get it...

Reproduce code snippet

const broker = new ServiceBroker({
    logger: [
				{
					type: "Console",
					options: {
						level: "trace",
						//formatter: "jsonext",
						colors: true,
						moduleColors: true,
						//autoPadding: true
					}
				},
				{
					type: "File",
					options: {
						level: "trace",
						formatter: "jsonext",
						folder: "d:/logs",
						filename: "moleculer-{date}.log",
					}
				},
			]
});

broker.createService({
    name: "test",
    actions: {
        empty(ctx) {
            return "Hello"
        }
    }
});

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Moleculer version:
  • NodeJS version:
  • Operating System:

Failure Logs


@icebob
Copy link
Member Author

icebob commented Sep 13, 2021

Option 1: not disabling coloring in kleur, instead unstyle the texts in logger appenders

Option 2: Fork kleur and make to instances. But it doesn't solve when user uses colors in custom log messages.

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

No branches or pull requests

1 participant