feat(Code Node)!: Add a flag to disable forwarding of code logging to stdout (#6966)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2023-08-25 14:23:23 +02:00 committed by GitHub
parent 596b5695cd
commit 0356419c1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View file

@ -2,6 +2,16 @@
This list shows all the versions which include breaking changes and how to upgrade.
## 1.5.0
### What changed?
In the Code node, `console.log` does not output to stdout by default.
### When is action necessary?
If you were relying on `console.log` for non-manual executions of a Code node, you need to set the env variable `CODE_ENABLE_STDOUT` to `true` to send Code node logs to process's stdout.
## 1.2.0
### What changed?

View file

@ -13,6 +13,8 @@ import { PythonSandbox } from './PythonSandbox';
import { getSandboxContext } from './Sandbox';
import { standardizeOutput } from './utils';
const { CODE_ENABLE_STDOUT } = process.env;
export class Code implements INodeType {
description: INodeTypeDescription = {
displayName: 'Code',
@ -114,8 +116,10 @@ export class Code implements INodeType {
'output',
workflowMode === 'manual'
? this.sendMessageToUI
: (...args) =>
console.log(`[Workflow "${this.getWorkflow().id}"][Node "${node.name}"]`, ...args),
: CODE_ENABLE_STDOUT === 'true'
? (...args) =>
console.log(`[Workflow "${this.getWorkflow().id}"][Node "${node.name}"]`, ...args)
: () => {},
);
return sandbox;
};