Skip to content

feat: disable error logging stacktrace in message #1705

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CorieW
Copy link
Member

@CorieW CorieW commented Jun 9, 2025

Resolves #1681

@CorieW CorieW force-pushed the @invertase/add-disable-error-traceback branch 5 times, most recently from d554ba6 to d805557 Compare June 9, 2025 16:11
@CorieW CorieW force-pushed the @invertase/add-disable-error-traceback branch from d805557 to 243c6b1 Compare June 9, 2025 16:16
@cabljac cabljac requested review from Copilot and cabljac June 16, 2025 08:34
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a new global option to disable automatic inclusion of error stacktraces in logs and updates the logger and tests to respect this setting.

  • Introduce disableErrorLoggingTraceback in GlobalOptions
  • Modify entryFromArgs to skip stacktrace when the option is enabled
  • Add tests for default stacktrace inclusion and disabling behavior

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/v2/options.ts Add disableErrorLoggingTraceback to GlobalOptions with accompanying JSDoc
src/logger/index.ts Check getGlobalOptions().disableErrorLoggingTraceback before injecting stacktrace
spec/logger.spec.ts Tests for error logging behavior with and without the new option
Comments suppressed due to low confidence (2)

src/v2/options.ts:241

  • Fix the JSDoc wording to remove the double negative, e.g. When true, the error message will not include the traceback of the error.
* When true, the error message will include not include the traceback of the error.

spec/logger.spec.ts:223

  • Consider adding a test case where logger.error is called with an actual Error object to ensure that existing Error instances aren’t wrapped with a new stacktrace.
describe("error logging stacktrace", () => {

});

it("when disableErrorLoggingTraceback is set to true, should not log stacktrace", () => {
const message = "Test error with traceback disabled";
Copy link
Preview

Copilot AI Jun 16, 2025

Choose a reason for hiding this comment

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

After modifying global options in tests, reset or restore them (e.g., in an afterEach) to avoid state leakage between tests.

Suggested change
const message = "Test error with traceback disabled";
const message = "Test error with traceback disabled";
const originalOptions = { ...setGlobalOptions() }; // Save original global options

Copilot uses AI. Check for mistakes.

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.

logger.error prints the stacktrace of line where it was invoked
1 participant