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

Support different printer for different output #23

Open
mivoligo opened this issue May 10, 2023 · 5 comments
Open

Support different printer for different output #23

mivoligo opened this issue May 10, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@mivoligo
Copy link

Is it possible to have a different printer for each output specified in MultiOutput()?
I can't see a good way to do that.

@Bungeefan
Copy link
Member

Unfortunately not.
Currently, there is only a one-to-one relationship possible between a logger and it's printer.

@mivoligo
Copy link
Author

OK, thanks for the very quick response 👍

@Bungeefan
Copy link
Member

You're welcome!
Do you want to keep this issue as a feature request, or should I close it?

@mivoligo
Copy link
Author

I think keeping it as a feature request could be fine. Maybe someone else will have similar requirements.

@Bungeefan Bungeefan added the enhancement New feature or request label May 10, 2023
@Bungeefan Bungeefan changed the title Different printer for different output Support different printer for different output May 10, 2023
@shovelmn12
Copy link

It's pretty easy to write such class:

class MultiOutput extends LogOutput {
  final List<LogOutput> outputs;
  
  MultiOutput({required this.outputs});
  
  @override
  Future<void> destroy() async {
    for (final output in outputs)
      await output.destroy();
  }

  @override
  Future<void> init() async {
    for (final output in outputs)
      await output.init();
  }
  
  @override
  void output(OutputEvent event) {
      for (final output in outputs)
        output.output(event);
  }
}

Good luck :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants