Skip to content

@W-21785596 logging refactor#314

Open
jarhun88 wants to merge 6 commits intomainfrom
dev/feat/logging
Open

@W-21785596 logging refactor#314
jarhun88 wants to merge 6 commits intomainfrom
dev/feat/logging

Conversation

@jarhun88
Copy link
Copy Markdown
Contributor

@jarhun88 jarhun88 commented Apr 17, 2026

IMPORTANT: Please do not create a Pull Request without creating an issue first.

Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of
the pull request.

Pull Request Template

Introduces a simplified three-level logging system (debug | info | error) with environment-variable-driven severity filtering, consolidates the logging API surface, and adds structured log() calls across previously unlogged or inconsistently logged code paths.

Breaking change: DEFAULT_LOG_LEVEL renamed to DEFAULT_NOTIFICATION_LEVEL to distinguish it from the new LOG_LEVEL env var. DEFAULT_NOTIFICATION_LEVEL controls what's sent to the MCP client; LOG_LEVEL controls what's written to console/file.

New env var: LOG_LEVEL controls server-side log output severity (debug, info, error). Defaults to info.

Description

Motivation and Context

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

How Has This Been Tested?

Related Issues

Checklist

  • I have updated the version in the package.json file by using npm run version. For example,
    use npm run version:patch for a patch version bump.
  • I have made any necessary changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have documented any breaking changes in the PR description. For example, renaming a config
    environment variable or changing its default value.

Contributor Agreement

By submitting this pull request, I confirm that:

@jarhun88 jarhun88 changed the title Dev/feat/logging @W-21785596 logging refactor Apr 17, 2026
Comment thread src/tools/tool.ts
@@ -150,6 +150,11 @@ export class Tool<Args extends ZodRawShape | undefined = undefined> {
const username = tableauAuthInfo?.username;

this.logInvocation({ requestId, args, username });
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

logInvocation is poorly named now since it sends notifications. What feels right? Rename to something like notifyOfInvocation? Or rename to logAndNotify and move the call to log inside it?

Comment thread package.json
"name": "@tableau/mcp-server",
"description": "Helping agents see and understand data.",
"version": "1.18.7",
"version": "1.20.0",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We've historically bumped the minor version when making a breaking change like this but to follow the principles of semver properly, we really should be making major version bumps for any breaking change.

Comment thread src/logging/logger.ts
const message = JSON.stringify(entry);
if (config.transport === 'http') {
// eslint-disable-next-line no-console -- console.log is intentional here since the transport is not stdio.
console.log(message);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we should extend LogParams to include an optional error?: unknown field, that way we can be smarter about how we log the error instead of just including it as part of the message using a template literal (which will remove important information from the error like stack trace). Thoughts?

if (config.transport === 'http') {
  if (error) {
    // LOG THE WHOLE ERROR
    console.log(message, error);

    // OR JUST A SUBSET OF THE ERROR
    console.log(message, { message: error.message, stack: error.stack });
  } else {
    console.log(message);
  }
} else {
  process.stderr.write(message.endsWith('\n') ? message : `${message} ${error}\n`);
  if (error) {
    process.stderr.write(${error}\n`);
  }
}

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.

2 participants