Skip to content

feat: introduce log level to logging

Tomas Vik (OOO back on 2025-01-02) requested to merge improve-logging into main

This MR introduces log level for logging. It also indents multiline log messages so the log level stays prominent.

Before

Found https://gitlab.com in the PAT list and git remotes, using it as the instanceUrl
Found https://gitlab.com in the PAT list and git remotes, using it as the instanceUrl
Found https://gitlab.com in the PAT list and git remotes, using it as the instanceUrl
401 - "{\"error\":\"invalid_token\",\"error_description\":\"Token is expired. You can either do re-authorization or token refresh.\"}"
StatusCodeError: 401 - "{\"error\":\"invalid_token\",\"error_description\":\"Token is expired. You can either do re-authorization or token refresh.\"}"
    at new StatusCodeError2 (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request-promise-core/lib/errors.js:32:15)
    at /home/tomas/workspace/gitlab-vscode-extension/node_modules/request-promise-core/lib/plumbing.js:97:41
    at processImmediate (internal/timers.js:461:21)
    at process.callbackTrampoline (internal/async_hooks.js:131:14)
From previous event:
    at Request.<anonymous> (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request-promise-core/lib/plumbing.js:36:28)
    at Request.RP$initInterceptor [as init] (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request-promise-core/configure/request2.js:41:27)
    at new Request (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request/request.js:127:8)
    at request2 (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request/index.js:53:10)
    at fetch (/home/tomas/workspace/gitlab-vscode-extension/src/gitlab_service.ts:72:10)
    at fetchOpenMergeRequestForCurrentBranch (/home/tomas/workspace/gitlab-vscode-extension/src/gitlab_service.ts:163:24)
    at fetchPipelineAndMrForCurrentBranch (/home/tomas/workspace/gitlab-vscode-extension/src/gitlab_service.ts:194:14)
    at Function.getState (/home/tomas/workspace/gitlab-vscode-extension/src/current_branch_refresher.ts:112:32)
    at CurrentBranchRefresher.refresh (/home/tomas/workspace/gitlab-vscode-extension/src/current_branch_refresher.ts:99:19)
    at CurrentBranchRefresher.clearAndSetIntervalAndRefresh (/home/tomas/workspace/gitlab-vscode-extension/src/current_branch_refresher.ts:85:5)
Found https://gitlab.com in the PAT list and git remotes, using it as the instanceUrl
401 - "{\"error\":\"invalid_token\",\"error_description\":\"Token is expired. You can either do re-authorization or token refresh.\"}"
StatusCodeError: 401 - "{\"error\":\"invalid_token\",\"error_description\":\"Token is expired. You can either do re-authorization or token refresh.\"}"
    at new StatusCodeError2 (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request-promise-core/lib/errors.js:32:15)
    at /home/tomas/workspace/gitlab-vscode-extension/node_modules/request-promise-core/lib/plumbing.js:97:41
    at processImmediate (internal/timers.js:461:21)
    at process.callbackTrampoline (internal/async_hooks.js:131:14)
From previous event:
    at Request.<anonymous> (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request-promise-core/lib/plumbing.js:36:28)
    at Request.RP$initInterceptor [as init] (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request-promise-core/configure/request2.js:41:27)
    at new Request (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request/request.js:127:8)
    at request2 (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request/index.js:53:10)
    at fetch (/home/tomas/workspace/gitlab-vscode-extension/src/gitlab_service.ts:72:10)
    at fetchOpenMergeRequestForCurrentBranch (/home/tomas/workspace/gitlab-vscode-extension/src/gitlab_service.ts:163:24)
    at fetchPipelineAndMrForCurrentBranch (/home/tomas/workspace/gitlab-vscode-extension/src/gitlab_service.ts:194:14)
    at Function.getState (/home/tomas/workspace/gitlab-vscode-extension/src/current_branch_refresher.ts:112:32)
    at CurrentBranchRefresher.refresh (/home/tomas/workspace/gitlab-vscode-extension/src/current_branch_refresher.ts:99:19)
    at CurrentBranchRefresher.clearAndSetIntervalAndRefresh (/home/tomas/workspace/gitlab-vscode-extension/src/current_branch_refresher.ts:85:5)
    at Timeout._onTimeout (/home/tomas/workspace/gitlab-vscode-extension/src/current_branch_refresher.ts:78:9)
Found https://gitlab.com in the PAT list and git remotes, using it as the instanceUrl
Found https://gitlab.com in the PAT list and git remotes, using it as the instanceUrl

After

[info]: Found https://gitlab.com in the PAT list and git remotes, using it as the instanceUrl
[info]: Found https://gitlab.com in the PAT list and git remotes, using it as the instanceUrl
[info]: Found https://gitlab.com in the PAT list and git remotes, using it as the instanceUrl
[error]: 401 - "{\"error\":\"invalid_token\",\"error_description\":\"Token is expired. You can either do re-authorization or token refresh.\"}"
         StatusCodeError: 401 - "{\"error\":\"invalid_token\",\"error_description\":\"Token is expired. You can either do re-authorization or token refresh.\"}"
             at new StatusCodeError2 (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request-promise-core/lib/errors.js:32:15)
             at /home/tomas/workspace/gitlab-vscode-extension/node_modules/request-promise-core/lib/plumbing.js:97:41
             at processImmediate (internal/timers.js:461:21)
             at process.callbackTrampoline (internal/async_hooks.js:131:14)
         From previous event:
             at Request.<anonymous> (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request-promise-core/lib/plumbing.js:36:28)
             at Request.RP$initInterceptor [as init] (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request-promise-core/configure/request2.js:41:27)
             at new Request (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request/request.js:127:8)
             at request2 (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request/index.js:53:10)
             at fetch (/home/tomas/workspace/gitlab-vscode-extension/src/gitlab_service.ts:72:10)
             at fetchOpenMergeRequestForCurrentBranch (/home/tomas/workspace/gitlab-vscode-extension/src/gitlab_service.ts:163:24)
             at fetchPipelineAndMrForCurrentBranch (/home/tomas/workspace/gitlab-vscode-extension/src/gitlab_service.ts:194:14)
             at Function.getState (/home/tomas/workspace/gitlab-vscode-extension/src/current_branch_refresher.ts:112:32)
             at CurrentBranchRefresher.refresh (/home/tomas/workspace/gitlab-vscode-extension/src/current_branch_refresher.ts:99:19)
             at CurrentBranchRefresher.clearAndSetIntervalAndRefresh (/home/tomas/workspace/gitlab-vscode-extension/src/current_branch_refresher.ts:85:5)
[info]: Found https://gitlab.com in the PAT list and git remotes, using it as the instanceUrl
[info]: Found https://gitlab.com in the PAT list and git remotes, using it as the instanceUrl
[info]: Found https://gitlab.com in the PAT list and git remotes, using it as the instanceUrl
[error]: 401 - "{\"error\":\"invalid_token\",\"error_description\":\"Token is expired. You can either do re-authorization or token refresh.\"}"
         StatusCodeError: 401 - "{\"error\":\"invalid_token\",\"error_description\":\"Token is expired. You can either do re-authorization or token refresh.\"}"
             at new StatusCodeError2 (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request-promise-core/lib/errors.js:32:15)
             at /home/tomas/workspace/gitlab-vscode-extension/node_modules/request-promise-core/lib/plumbing.js:97:41
             at processImmediate (internal/timers.js:461:21)
             at process.callbackTrampoline (internal/async_hooks.js:131:14)
         From previous event:
             at Request.<anonymous> (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request-promise-core/lib/plumbing.js:36:28)
             at Request.RP$initInterceptor [as init] (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request-promise-core/configure/request2.js:41:27)
             at new Request (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request/request.js:127:8)
             at request2 (/home/tomas/workspace/gitlab-vscode-extension/node_modules/request/index.js:53:10)
             at fetch (/home/tomas/workspace/gitlab-vscode-extension/src/gitlab_service.ts:72:10)
             at fetchLastPipelineForCurrentBranch (/home/tomas/workspace/gitlab-vscode-extension/src/gitlab_service.ts:134:35)
             at fetchPipelineAndMrForCurrentBranch (/home/tomas/workspace/gitlab-vscode-extension/src/gitlab_service.ts:199:20)
             at Function.getState (/home/tomas/workspace/gitlab-vscode-extension/src/current_branch_refresher.ts:112:32)
             at CurrentBranchRefresher.refresh (/home/tomas/workspace/gitlab-vscode-extension/src/current_branch_refresher.ts:99:19)
             at CurrentBranchRefresher.clearAndSetIntervalAndRefresh (/home/tomas/workspace/gitlab-vscode-extension/src/current_branch_refresher.ts:85:5)

Merge request reports

Loading