question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Export the logger for plugins

See original GitHub issue

Export the logger for plugins

Environments

  • Prettier Version: 1.19.1
  • Running Prettier via: CLI
  • Runtime: Node.js v10+
  • Operating System: Windows, Linux, macOS

Steps to reproduce

  • Just write a plugin ^^ (like @prettier/plugin-pug)
  • Try to access the logger so that the CLI option --loglevel can take effect and can be used for the plugin
  • Also benefit from chalk cli coloring

Expected behavior

The logger can be used/accessed in a plugin

Actual behavior

I had to write a logger by myself And this could not be managed by --loglevel 🙁

Old Issue

#3585 that was locked-due-to-inactivity 👎

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
thorn0commented, Jan 17, 2020

and use prettier’s loggers

The thing is Prettier itself doesn’t have loggers. Its CLI does, but the CLI is a kind of separate thing. Think of it as of a separate package, which it (or a completely new CLI) should eventually become. It’s a Node program that uses Prettier API, whereas Prettier proper is an environment-independent library.

So even if we decide to support this use case, we can’t do it the way you did in your PR. The plugin helpers (util-shared) can’t use things like chalk or process.stdout. Pieces of the CLI code can’t leave the /cli directory and can’t be used in other directories.

0reactions
Shinigami92commented, Jan 17, 2020

Ok that’s a point I understand 😕

Read more comments on GitHub >

github_iconTop Results From Across the Web

Advanced PBX Data Logger - Plugins - AGG Software
This data export module for Advanced PBX Data Logger is used for recording and saving the parsed data into SQL-compatible databases: Microsoft SQLServer,...
Read more >
How to import and export WP Activity Log configuration settings
1. Click on WP Activity Log from the WordPress side menu · 2. Click on Settings from the WP Activity Log piano menu...
Read more >
Logger Interface - webpack
Webpack logger is available to loaders and plugins. ... const PLUGIN_NAME = 'my-webpack-plugin'; export class MyWebpackPlugin { apply(compiler) { // you can ...
Read more >
How To Export CRM Plugin Error Logs - Outreach Support
Access the Outreach Platform. · Access the CRM Plugin. · Click the Logs tab. · Click the Export button to the right of...
Read more >
Log Export | WordPress.org
You can't export any logs from the Wordfence plugin. All you can do is to setup email alerts and also send an activity...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found