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

Print logs to stderr #4922

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Print logs to stderr #4922

wants to merge 2 commits into from

Conversation

gonzaloriestra
Copy link
Contributor

@gonzaloriestra gonzaloriestra commented Nov 26, 2024

WHY are these changes introduced?

Fixes #3863

WHAT is this pull request doing?

How to test your changes?

Post-release steps

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor

Unused dependencies (1)

Filename dependencies
packages/app/package.json micromatch

Unused devDependencies (1)

Filename devDependencies
packages/app/package.json @types/micromatch

Unused types (1)

Filename types
packages/app/src/cli/services/build/extension.ts BuildFunctionExtensionOptions

Copy link
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/output.d.ts
@@ -141,19 +141,19 @@ export interface OutputProcess {
     action: (stdout: Writable, stderr: Writable, signal: AbortSignal) => Promise<void>;
 }
 /**
- * Prints a log message in the console.
+ * Prints a log message in the console to stdout.
  *
  * @param message - The message to print.
  */
 export declare function consoleLog(message: string): void;
 /**
- * Prints an error message in the console.
+ * Prints an error message in the console to stderr.
  *
  * @param message - The message to print.
  */
 export declare function consoleError(message: string): void;
 /**
- * Prints a warning message in the console.
+ * Prints a warning message in the console to stderr.
  *
  * @param message - The message to print.
  */

@@ -258,7 +256,7 @@ export const clearCollectedLogs = (): void => {
* @param content - The content to be output to the user.
* @param logger - The logging function to use to output to the user.
*/
export function outputInfo(content: OutputMessage, logger: Logger = consoleLog): void {
export function outputInfo(content: OutputMessage, logger: Logger = consoleWarn): void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I suggest a export function output(content: outputMessage, logger: Logger = consoleLog): void {

?

That way all the output{log,warn,error} would all go to stderr and we'd make it explicit which one goes to stdout?

STDOUT = scriptable output
STDERR = logging

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

Successfully merging this pull request may close these issues.

[Bug]: Logging should be done to STDERR by default. STDOUT should be reserved for scriptable output.
2 participants