Skip to content

Commit

Permalink
Node: Check debug mode for debug logs (#1046)
Browse files Browse the repository at this point in the history
* check debug mode for debug logs

* Bump package version

* Update changelog

* re-bump version

* Use dynamic feature flag variable

* Fix condition
  • Loading branch information
KonstantinTyukalov authored Jul 29, 2024
1 parent 51ae910 commit a783d8a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
4 changes: 4 additions & 0 deletions node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 4.x

## 4.15.0

- Disabled debug logs when debug mode is not enabled - [#1046](https://github.com/microsoft/azure-pipelines-task-lib/pull/1046)

## 4.12.1

- Remove deasync from task-lib - [#1038](https://github.com/microsoft/azure-pipelines-task-lib/pull/1038)
Expand Down
10 changes: 9 additions & 1 deletion node/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,16 @@ export function _error(
);
}

const debugMode = _getVariable('system.debug')?.toLowerCase() === 'true';
const shouldCheckDebugMode = _getVariable('DistributedTask.Tasks.Node.SkipDebugLogsWhenDebugModeOff')?.toLowerCase() === 'true';

export function _debug(message: string): void {
_command('task.debug', null, message);
if (
!shouldCheckDebugMode
|| (shouldCheckDebugMode && debugMode)
) {
_command('task.debug', null, message);
}
}

// //-----------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions node/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azure-pipelines-task-lib",
"version": "4.14.0",
"version": "4.15.0",
"description": "Azure Pipelines Task SDK",
"main": "./task.js",
"typings": "./task.d.ts",
Expand Down

0 comments on commit a783d8a

Please sign in to comment.