Skip to content
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

Allow apps to control FDC3 for Web JS console logging #1495

Open
wants to merge 8 commits into
base: fdc3-for-web-impl
Choose a base branch
from

Conversation

kriswest
Copy link
Contributor

@kriswest kriswest commented Jan 15, 2025

Describe your change

Adds the ability to control debug logging output from getAgent() and the DesktopAgentProxy via new arguments to getAgent(). The new arguments are documented in the types and documentation pages.

Docs changes can be found in the preview at: https://deploy-preview-1495--fdc3.netlify.app/docs/next/api/ref/GetAgent

Related Issue

resolves #1487

Contributor License Agreement

  • I acknowledge that a contributor license agreement is required and that I have one in place or will seek to put one in place ASAP.

Review Checklist

  • Issue: If a change was made to the FDC3 Standard, was an issue linked above?
  • CHANGELOG: Is a CHANGELOG.md entry included?
  • API changes: Does this PR include changes to any of the FDC3 APIs (DesktopAgent, Channel, PrivateChannel, Listener, Bridging)?
    • Docs & Sources: If yes, were both documentation (/docs) and sources updated?

      JSDoc comments on interfaces and types should be matched to the main documentation in /docs

@kriswest kriswest requested a review from a team as a code owner January 15, 2025 18:49
Copy link

linux-foundation-easycla bot commented Jan 15, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link

netlify bot commented Jan 15, 2025

Deploy Preview for fdc3 canceled.

Name Link
🔨 Latest commit 19a0f8e
🔍 Latest deploy log https://app.netlify.com/sites/fdc3/deploys/678803a212ab53000847397f

@kriswest kriswest changed the base branch from main to fdc3-for-web-impl January 15, 2025 18:51
@kriswest
Copy link
Contributor Author

/easycla

@kriswest kriswest requested a review from robmoffat January 15, 2025 18:52
Copy link

496 passed

Copy link

github-actions bot commented Jan 15, 2025

Coverage Report

Commit: 3ab5d45
Base: fdc3-for-web-impl@029f617

Type Base This PR
Total Statements Coverage  97.32%  97.36% (+0.04%)
Total Branches Coverage  86.09%  86.95% (+0.86%)
Total Functions Coverage  98.07%  97.89% (-0.18%)
Total Lines Coverage  97.33%  97.38% (+0.05%)
Details (changed files)
FileStatementsBranchesFunctionsLines
packages/fdc3-agent-proxy/src/DesktopAgentProxy.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/index.ts 100% 100% 62.5% 100%
packages/fdc3-agent-proxy/src/apps/DefaultAppSupport.ts 86.95% 50% 100% 86.95%
packages/fdc3-agent-proxy/src/channels/DefaultChannelSupport.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/intents/DefaultIntentSupport.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/listeners/AbstractListener.ts 100% 60% 100% 100%
packages/fdc3-agent-proxy/src/listeners/HeartbeatListener.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/listeners/PrivateChannelEventListener.ts 93.33% 72.72% 100% 93.33%
packages/fdc3-agent-proxy/src/messaging/AbstractMessaging.ts 93.93% 100% 80% 93.93%
packages/fdc3-agent-proxy/src/util/AbstractFDC3Logger.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/util/Logger.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/util/throwIfUndefined.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/messaging/message-port.ts 97.43% 93.33% 100% 97.43%
packages/fdc3-get-agent/src/strategies/FailoverHandler.ts 100% 84.21% 100% 100%
packages/fdc3-get-agent/src/strategies/PostMessageLoader.ts 98.46% 88% 100% 98.43%
packages/fdc3-get-agent/src/strategies/getAgent.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/util/Logger.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/GetAgent.ts 100% 100% 100% 100%
Details (all files)
FileStatementsBranchesFunctionsLines
packages/fdc3-agent-proxy/src/DesktopAgentProxy.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/index.ts 100% 100% 62.5% 100%
packages/fdc3-agent-proxy/src/apps/DefaultAppSupport.ts 86.95% 50% 100% 86.95%
packages/fdc3-agent-proxy/src/channels/DefaultChannel.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/channels/DefaultChannelSupport.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/channels/DefaultPrivateChannel.ts 97.29% 66.66% 100% 97.29%
packages/fdc3-agent-proxy/src/heartbeat/DefaultHeartbeatSupport.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/intents/DefaultIntentResolution.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/intents/DefaultIntentSupport.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/listeners/AbstractListener.ts 100% 60% 100% 100%
packages/fdc3-agent-proxy/src/listeners/DefaultContextListener.ts 100% 90% 100% 100%
packages/fdc3-agent-proxy/src/listeners/DefaultIntentListener.ts 100% 77.77% 100% 100%
packages/fdc3-agent-proxy/src/listeners/EventListener.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/listeners/HeartbeatListener.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/listeners/PrivateChannelEventListener.ts 93.33% 72.72% 100% 93.33%
packages/fdc3-agent-proxy/src/messaging/AbstractMessaging.ts 93.93% 100% 80% 93.93%
packages/fdc3-agent-proxy/src/util/AbstractFDC3Logger.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/util/Logger.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/util/throwIfUndefined.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/index.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/messaging/MessagePortMessaging.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/messaging/message-port.ts 97.43% 93.33% 100% 97.43%
packages/fdc3-get-agent/src/sessionStorage/DesktopAgentDetails.ts 97.36% 89.47% 100% 97.36%
packages/fdc3-get-agent/src/strategies/DesktopAgentPreloadLoader.ts 100% 81.25% 100% 100%
packages/fdc3-get-agent/src/strategies/FailoverHandler.ts 100% 84.21% 100% 100%
packages/fdc3-get-agent/src/strategies/HelloHandler.ts 93.75% 75% 100% 93.75%
packages/fdc3-get-agent/src/strategies/IdentityValidationHandler.ts 95.65% 73.33% 100% 95.65%
packages/fdc3-get-agent/src/strategies/PostMessageLoader.ts 98.46% 88% 100% 98.43%
packages/fdc3-get-agent/src/strategies/getAgent.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/ui/AbstractUIComponent.ts 97.1% 71.42% 100% 96.96%
packages/fdc3-get-agent/src/ui/DefaultDesktopAgentChannelSelector.ts 100% 75% 100% 100%
packages/fdc3-get-agent/src/ui/DefaultDesktopAgentIntentResolver.ts 100% 90% 100% 100%
packages/fdc3-get-agent/src/ui/NullChannelSelector.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/ui/NullIntentResolver.ts 100% 100% 66.66% 100%
packages/fdc3-get-agent/src/util/Logger.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/util/Uuid.ts 100% 100% 100% 100%
packages/fdc3-standard/src/index.ts 100% 100% 0% 100%
packages/fdc3-standard/src/api/Errors.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/GetAgent.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/Methods.ts 94.04% 84.05% 96.29% 95%
packages/fdc3-standard/src/api/RecommendedChannels.ts 100% 100% 100% 100%
packages/fdc3-standard/src/context/ContextType.ts 100% 100% 100% 100%
packages/fdc3-standard/src/intents/Intents.ts 100% 100% 100% 100%
packages/fdc3-standard/src/internal/contextConfiguration.ts 100% 100% 100% 100%
packages/fdc3-standard/src/internal/intentConfiguration.ts 100% 100% 100% 100%
packages/fdc3-standard/src/internal/typeHelpers.ts 100% 100% 100% 100%
toolbox/fdc3-for-web/fdc3-web-impl/src/BasicFDC3Server.ts 100% 100% 100% 100%
toolbox/fdc3-for-web/fdc3-web-impl/src/ServerContext.ts 100% 100% 100% 100%
toolbox/fdc3-for-web/fdc3-web-impl/src/directory/BasicDirectory.ts 96.87% 84.21% 100% 96.55%
toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/BroadcastHandler.ts 96.38% 86.41% 100% 96.12%
toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/HeartbeatHandler.ts 88.23% 71.87% 86.66% 90%
toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/IntentHandler.ts 95.6% 86.56% 100% 95%
toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/OpenHandler.ts 97.14% 86.84% 100% 97.14%
toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/support.ts 100% 100% 100% 100%

Copy link

496 passed

Copy link

496 passed

@kriswest kriswest changed the title Fdc3 for web impl debug logs Allow apps to Control FDC3 for Web JS console logging Jan 16, 2025
@kriswest kriswest changed the title Allow apps to Control FDC3 for Web JS console logging Allow apps to control FDC3 for Web JS console logging Jan 16, 2025
Copy link
Contributor

@kemerava kemerava left a comment

Choose a reason for hiding this comment

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

LGTM!

@kriswest kriswest requested review from novavi and a team January 16, 2025 17:15

export type DesktopAgentProxyLogSettings = {
heartbeat: boolean;
debug: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

Should this be explicit level for more refined control versus just debug yes or no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its does feel a little scrappy this way, but the issue is we've got two scopes to control logging in: the connection phase and the proxy itself + within the proxy there are two types of debug message that we need to keep separate for usability: logging API messages sent/received and logging heartbeat messages. Collectively, that made it a little harder to base purely on a log level.

I suppose one solution would be to move the message logging in the proxy to the log level but set the default level to warn...

The current proposed args are:

export type GetAgentLogSettings = {
  connection: boolean,  //default true
  connectionDebug: boolean,  //default false
  proxyDebug: boolean,  //default false
  heartbeat: boolean  // default false
};

By moving message loggimg to the log level we could do:

export type GetAgentLogSettings = {
  connectionLogLevel: "debug" | "log" | "warn" | "error" ,  //default "log"
  proxyLogLevel: boolean,  "debug" | "log" | "warn" | "error" ,  //default "warn"
};

Copy link

496 passed

Copy link

496 passed

Copy link

496 passed

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.

Allow apps to control logging used in getAgent / agent-proxy
3 participants