Skip to content

feat(Core): set log level using config - #2865

Open
daker wants to merge 13 commits into
cornerstonejs:mainfrom
daker:remove-log
Open

feat(Core): set log level using config#2865
daker wants to merge 13 commits into
cornerstonejs:mainfrom
daker:remove-log

Conversation

@daker

@daker daker commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Context

Fixes #2848

Changes & Results

Testing

Checklist

PR

  • [] My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • [] My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • [] The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • [] "OS:
  • [] "Node version:
  • [] "Browser:

Summary by CodeRabbit

  • Bug Fixes
    • Removed unnecessary diagnostic messages during image metadata loading.
    • Removed a misleading warning when compressed frame data is unavailable.
    • Preserved existing error handling and metadata loading behavior.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Too many files!

This PR contains 232 files, which is 82 over the limit of 150.

To get a review, reduce the PR to 150 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 2cc69a25-a91b-4710-86d2-0fe175b23dab

📥 Commits

Reviewing files that changed from the base of the PR and between 9ea73be and 88c61fc.

📒 Files selected for processing (232)
  • packages/adapters/src/adapters/Cornerstone/MeasurementReport.js
  • packages/adapters/src/adapters/Cornerstone/ParametricMap.ts
  • packages/adapters/src/adapters/Cornerstone/Segmentation.js
  • packages/adapters/src/adapters/Cornerstone/Segmentation_3X.js
  • packages/adapters/src/adapters/Cornerstone/Segmentation_4X.js
  • packages/adapters/src/adapters/Cornerstone3D/MeasurementReport.ts
  • packages/adapters/src/adapters/Cornerstone3D/RTStruct/RTSS.ts
  • packages/adapters/src/adapters/Cornerstone3D/Segmentation/generateSegmentation.ts
  • packages/adapters/src/adapters/Cornerstone3D/Segmentation/labelmapImagesFromBuffer.ts
  • packages/ai/src/LabelmapSlicePropagationTool.ts
  • packages/ai/src/MarkerLabelmapTool.ts
  • packages/ai/src/ONNXSegmentationController.ts
  • packages/core/src/RenderingEngine/BaseRenderingEngine.ts
  • packages/core/src/RenderingEngine/BaseVolumeViewport.ts
  • packages/core/src/RenderingEngine/ContextPoolRenderingEngine.ts
  • packages/core/src/RenderingEngine/GenericViewport/DefaultRenderPathResolver.ts
  • packages/core/src/RenderingEngine/GenericViewport/Planar/DefaultPlanarDataProvider.ts
  • packages/core/src/RenderingEngine/GenericViewport/Planar/PlanarViewport.ts
  • packages/core/src/RenderingEngine/GenericViewport/Planar/PlanarViewportLegacyAdapter.ts
  • packages/core/src/RenderingEngine/RenderingEngine.ts
  • packages/core/src/RenderingEngine/StackViewport.ts
  • packages/core/src/RenderingEngine/TiledRenderingEngine.ts
  • packages/core/src/RenderingEngine/VideoViewport.ts
  • packages/core/src/RenderingEngine/Viewport.ts
  • packages/core/src/RenderingEngine/VolumeViewport.ts
  • packages/core/src/RenderingEngine/WSIViewport.ts
  • packages/core/src/RenderingEngine/helpers/addImageSlicesToViewports.ts
  • packages/core/src/RenderingEngine/helpers/addVolumesToViewports.ts
  • packages/core/src/RenderingEngine/helpers/attachWebGLContextEvents.ts
  • packages/core/src/RenderingEngine/helpers/cpuFallback/rendering/renderPseudoColorImage.ts
  • packages/core/src/RenderingEngine/helpers/getCameraVectors.ts
  • packages/core/src/RenderingEngine/helpers/stats/StatsOverlay.ts
  • packages/core/src/RenderingEngine/helpers/volumeNewImageEventDispatcher.ts
  • packages/core/src/RenderingEngine/vtkClasses/vtkStreamingOpenGLTexture.js
  • packages/core/src/RenderingEngine/vtkClasses/vtkStreamingOpenGLVolumeMapper.js
  • packages/core/src/cache/cache.ts
  • packages/core/src/cache/classes/BaseStreamingImageVolume.ts
  • packages/core/src/eventTarget.ts
  • packages/core/src/init.ts
  • packages/core/src/loaders/ProgressiveRetrieveImages.ts
  • packages/core/src/loaders/cornerstoneStreamingImageVolumeLoader.ts
  • packages/core/src/loaders/fillNearbyFrames.ts
  • packages/core/src/requestPool/requestPoolManager.ts
  • packages/core/src/utilities/ProgressiveIterator.ts
  • packages/core/src/utilities/RLEVoxelMap.ts
  • packages/core/src/utilities/VoxelManager.ts
  • packages/core/src/utilities/calculateSpacingBetweenImageIds.ts
  • packages/core/src/utilities/calculateViewportsSpatialRegistration.ts
  • packages/core/src/utilities/deepEqual.ts
  • packages/core/src/utilities/eventListener/TargetEventListeners.ts
  • packages/core/src/utilities/getBufferConfiguration.ts
  • packages/core/src/utilities/getImageSliceDataForVolumeViewport.ts
  • packages/core/src/utilities/getVolumeSliceRangeInfo.ts
  • packages/core/src/utilities/loadImageToCanvas.ts
  • packages/core/src/utilities/logger.ts
  • packages/core/src/webWorkerManager/webWorkerManager.ts
  • packages/core/test/defaultPlanarDataProvider.jest.js
  • packages/core/test/utilities/splitImageIdsBy4DTags.jest.js
  • packages/dicomImageLoader/src/__tests__/scalingAndParsing.spec.ts
  • packages/dicomImageLoader/src/__tests__/wadorsMetaDataPrimitives.spec.ts
  • packages/dicomImageLoader/src/__tests__/wadouriDataSetLayer.spec.ts
  • packages/dicomImageLoader/src/imageLoader/createImage.ts
  • packages/dicomImageLoader/src/imageLoader/getInstanceModule.ts
  • packages/dicomImageLoader/src/imageLoader/internal/rangeRequest.ts
  • packages/dicomImageLoader/src/imageLoader/internal/streamRequest.ts
  • packages/dicomImageLoader/src/imageLoader/internal/xhrRequest.ts
  • packages/dicomImageLoader/src/imageLoader/wadors/findIndexOfString.ts
  • packages/dicomImageLoader/src/imageLoader/wadors/loadImage.ts
  • packages/dicomImageLoader/src/imageLoader/wadors/loadImage_test.ts
  • packages/dicomImageLoader/src/imageLoader/wadors/metaData/ECGHelpers.ts
  • packages/dicomImageLoader/src/imageLoader/wadors/metaData/getSequenceItems.ts
  • packages/dicomImageLoader/src/imageLoader/wadors/register.ts
  • packages/dicomImageLoader/src/imageLoader/wadouri/dataSetCacheManager.ts
  • packages/dicomImageLoader/src/imageLoader/wadouri/dataset-from-partial-content.ts
  • packages/dicomImageLoader/src/imageLoader/wadouri/getUncompressedImageFrame.ts
  • packages/dicomImageLoader/src/imageLoader/wadouri/loadImage.ts
  • packages/dicomImageLoader/src/imageLoader/wadouri/metaData/getLUTs.ts
  • packages/dicomImageLoader/src/imageLoader/wadouri/register.ts
  • packages/dicomImageLoader/src/shared/decoders/decodeHTJ2K.ts
  • packages/dicomImageLoader/src/shared/scaling/bilinear.ts
  • packages/dicomImageLoader/src/shared/scaling/replicate.ts
  • packages/docs/docs/how-to-guides/configuration.md
  • packages/docs/docs/migration-guides/2x/7-nifti-volume-loader.md
  • packages/docs/docs/tutorials/basic-video.md
  • packages/docs/sidebars.js
  • packages/labelmap-interpolation/src/utilities/interpolateLabelmap.ts
  • packages/labelmap-interpolation/src/workers/interpolationWorker.js
  • packages/metadata/src/metaData.ts
  • packages/metadata/src/utilities/Tags.ts
  • packages/metadata/src/utilities/getPixelSpacingInformation.ts
  • packages/metadata/src/utilities/logging.ts
  • packages/metadata/src/utilities/metadataProvider/cacheData.ts
  • packages/metadata/src/utilities/metadataProvider/compressedFrameData.ts
  • packages/metadata/src/utilities/metadataProvider/ecgFromInstance.ts
  • packages/metadata/src/utilities/splitImageIdsBy4DTags.ts
  • packages/metadata/test/metaDataAddGetSplit.jest.js
  • packages/nifti-volume-loader/examples/niftiBasic/index.ts
  • packages/nifti-volume-loader/examples/niftiWithTools/index.ts
  • packages/nifti-volume-loader/src/cornerstoneNiftiImageLoader.ts
  • packages/nifti-volume-loader/src/createNiftiImageIdsAndCacheMetadata.ts
  • packages/polymorphic-segmentation/src/Contour/contourComputationStrategies.ts
  • packages/polymorphic-segmentation/src/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.ts
  • packages/polymorphic-segmentation/src/Labelmap/labelmapComputationStrategies.ts
  • packages/polymorphic-segmentation/src/Surface/surfaceComputationStrategies.ts
  • packages/polymorphic-segmentation/src/canComputeRequestedRepresentation.ts
  • packages/polymorphic-segmentation/src/utilities/clipAndCacheSurfacesForViewport.ts
  • packages/polymorphic-segmentation/src/workers/polySegConverters.js
  • packages/tools/src/config.ts
  • packages/tools/src/cursors/setCursorForElement.ts
  • packages/tools/src/eventDispatchers/mouseEventHandlers/mouseDownActivate.ts
  • packages/tools/src/eventDispatchers/touchEventHandlers/touchStartActivate.ts
  • packages/tools/src/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.ts
  • packages/tools/src/stateManagement/annotation/AnnotationRenderingEngine.ts
  • packages/tools/src/stateManagement/segmentation/SegmentationRenderingEngine.spec.ts
  • packages/tools/src/stateManagement/segmentation/SegmentationRenderingEngine.ts
  • packages/tools/src/stateManagement/segmentation/SegmentationStateManager.ts
  • packages/tools/src/stateManagement/segmentation/addColorLUT.ts
  • packages/tools/src/stateManagement/segmentation/config/segmentationColor.ts
  • packages/tools/src/stateManagement/segmentation/internalAddRepresentationData.ts
  • packages/tools/src/stateManagement/segmentation/internalAddSegmentationRepresentation.ts
  • packages/tools/src/stateManagement/segmentation/removeSegmentationRepresentations.ts
  • packages/tools/src/stateManagement/segmentation/segmentIndex.ts
  • packages/tools/src/stateManagement/segmentation/utilities/convertContourHoles.ts
  • packages/tools/src/stateManagement/segmentation/utilities/decimateContours.ts
  • packages/tools/src/stateManagement/segmentation/utilities/getPolylineMap.ts
  • packages/tools/src/stateManagement/segmentation/utilities/removeContourHoles.ts
  • packages/tools/src/stateManagement/segmentation/utilities/removeContourIslands.ts
  • packages/tools/src/stateManagement/segmentation/utilities/smoothContours.ts
  • packages/tools/src/store/SynchronizerManager/Synchronizer.ts
  • packages/tools/src/store/ToolGroupManager/ToolGroup.ts
  • packages/tools/src/store/ToolGroupManager/createToolGroup.ts
  • packages/tools/src/store/filterToolsWithAnnotationsForElement.ts
  • packages/tools/src/tools/AdvancedMagnifyTool.ts
  • packages/tools/src/tools/CrosshairsTool.ts
  • packages/tools/src/tools/MIPJumpToClickTool.ts
  • packages/tools/src/tools/OrientationControllerTool.ts
  • packages/tools/src/tools/OverlayGridTool.ts
  • packages/tools/src/tools/ReferenceCursors.ts
  • packages/tools/src/tools/ReferenceLinesTool.ts
  • packages/tools/src/tools/SculptorTool.ts
  • packages/tools/src/tools/SegmentationIntersectionTool.ts
  • packages/tools/src/tools/VolumeCroppingControlTool.ts
  • packages/tools/src/tools/VolumeCroppingTool.ts
  • packages/tools/src/tools/WindowLevelRegionTool.ts
  • packages/tools/src/tools/annotation/AngleTool.ts
  • packages/tools/src/tools/annotation/ArrowAnnotateTool.ts
  • packages/tools/src/tools/annotation/BidirectionalTool.ts
  • packages/tools/src/tools/annotation/CircleROITool.ts
  • packages/tools/src/tools/annotation/CobbAngleTool.ts
  • packages/tools/src/tools/annotation/DragProbeTool.ts
  • packages/tools/src/tools/annotation/ETDRSGridTool.ts
  • packages/tools/src/tools/annotation/EllipticalROITool.ts
  • packages/tools/src/tools/annotation/HeightTool.ts
  • packages/tools/src/tools/annotation/KeyImageTool.ts
  • packages/tools/src/tools/annotation/LabelTool.ts
  • packages/tools/src/tools/annotation/LengthTool.ts
  • packages/tools/src/tools/annotation/LivewireContourTool.ts
  • packages/tools/src/tools/annotation/ProbeTool.ts
  • packages/tools/src/tools/annotation/RectangleROITool.ts
  • packages/tools/src/tools/annotation/SplineROITool.ts
  • packages/tools/src/tools/annotation/UltrasoundDirectionalTool.ts
  • packages/tools/src/tools/annotation/UltrasoundPleuraBLineTool/UltrasoundPleuraBLineTool.ts
  • packages/tools/src/tools/annotation/VideoRedactionTool.ts
  • packages/tools/src/tools/annotation/planarFreehandROITool/findOpenUShapedContourVectorToPeak.ts
  • packages/tools/src/tools/base/AnnotationTool.ts
  • packages/tools/src/tools/base/ContourBaseTool.ts
  • packages/tools/src/tools/displayTools/Contour/contourDisplay.ts
  • packages/tools/src/tools/displayTools/Contour/contourHandler/handleContourSegmentation.ts
  • packages/tools/src/tools/displayTools/Contour/contourHandler/utils.ts
  • packages/tools/src/tools/displayTools/Labelmap/labelmapDisplay.ts
  • packages/tools/src/tools/displayTools/Labelmap/labelmapRenderPlan.spec.ts
  • packages/tools/src/tools/displayTools/Labelmap/labelmapRenderPlan/legacyVolumePlan.ts
  • packages/tools/src/tools/displayTools/Labelmap/syncStackLabelmapActors.ts
  • packages/tools/src/tools/displayTools/Surface/surfaceDisplay.ts
  • packages/tools/src/tools/segmentation/CircleROIStartEndThresholdTool.ts
  • packages/tools/src/tools/segmentation/CircleScissorsTool.ts
  • packages/tools/src/tools/segmentation/LabelmapEditWithContour.ts
  • packages/tools/src/tools/segmentation/PaintFillTool.ts
  • packages/tools/src/tools/segmentation/RectangleROIStartEndThresholdTool.ts
  • packages/tools/src/tools/segmentation/RectangleROIThresholdTool.ts
  • packages/tools/src/tools/segmentation/RectangleScissorsTool.ts
  • packages/tools/src/tools/segmentation/SegmentBidirectionalTool.ts
  • packages/tools/src/tools/segmentation/SphereScissorsTool.ts
  • packages/tools/src/tools/segmentation/strategies/compositions/circularCursor.ts
  • packages/tools/src/tools/segmentation/strategies/compositions/index.ts
  • packages/tools/src/utilities/calibrateImageSpacing.ts
  • packages/tools/src/utilities/cine/playClip.ts
  • packages/tools/src/utilities/contourSegmentation/applyContourStroke.ts
  • packages/tools/src/utilities/contourSegmentation/contourSegmentationOperation.ts
  • packages/tools/src/utilities/contourSegmentation/convertContourSegmentation.ts
  • packages/tools/src/utilities/contourSegmentation/logicalOperators.ts
  • packages/tools/src/utilities/contourSegmentation/mergeMultipleAnnotations.ts
  • packages/tools/src/utilities/contourSegmentation/sharedOperations.ts
  • packages/tools/src/utilities/contours/detectContourHoles.ts
  • packages/tools/src/utilities/contours/generateContourSetsFromLabelmap.ts
  • packages/tools/src/utilities/contours/interpolation/findAnnotationForInterpolation.ts
  • packages/tools/src/utilities/contours/interpolation/interpolate.ts
  • packages/tools/src/utilities/dynamicVolume/generateImageFromTimeData.ts
  • packages/tools/src/utilities/dynamicVolume/getDataInTime.ts
  • packages/tools/src/utilities/livewire/LivewireScissors.ts
  • packages/tools/src/utilities/math/basic/Calculator.ts
  • packages/tools/src/utilities/math/polyline/addCanvasPointsToArray.ts
  • packages/tools/src/utilities/math/polyline/combinePolyline.ts
  • packages/tools/src/utilities/math/polyline/intersectPolylines.ts
  • packages/tools/src/utilities/math/polyline/subtractPolylines.ts
  • packages/tools/src/utilities/planarFreehandROITool/smoothPoints.ts
  • packages/tools/src/utilities/segmentation/InterpolationManager/InterpolationManager.ts
  • packages/tools/src/utilities/segmentation/growCut/runFloodFillSegmentation.ts
  • packages/tools/src/utilities/segmentation/growCut/runGrowCut.ts
  • packages/tools/src/utilities/segmentation/growCut/runGrowCutForSphere.ts
  • packages/tools/src/utilities/segmentation/growCut/runOneClickGrowCut.ts
  • packages/tools/src/utilities/segmentation/isLineInSegment.ts
  • packages/tools/src/utilities/segmentation/islandRemoval.ts
  • packages/tools/src/utilities/segmentation/segmentContourAction.ts
  • packages/tools/src/utilities/segmentation/utilsForWorker.ts
  • packages/tools/src/utilities/spatial/areViewportsSpatiallyLinked.ts
  • packages/tools/src/utilities/spatial/spatial.spec.ts
  • packages/tools/src/utilities/spatial/types.ts
  • packages/tools/src/utilities/stackPrefetch/stackContextPrefetch.ts
  • packages/tools/src/utilities/stackPrefetch/stackPrefetch.ts
  • packages/tools/src/utilities/triggerAnnotationRenderForToolGroupIds.ts
  • packages/tools/src/utilities/triggerAnnotationRenderForViewportIds.ts
  • packages/tools/src/utilities/voi/colorbar/Colorbar.ts
  • packages/tools/src/utilities/voi/windowlevel/extractWindowLevelRegionToolData.ts
  • packages/tools/src/utilities/vtkjs/OrientationControllerWidget/index.ts
  • packages/tools/src/widgets/Widget.ts
  • packages/tools/src/workers/computeWorker.js
  • packages/tools/test/annotationStateManagement.jest.js
  • packages/tools/test/storeToolFilters.jest.js
  • packages/tools/test/synchronizerCore.jest.js
  • packages/utils/src/utilities/logging/index.ts
  • utils/assets/assetsURL.json

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: afd1f417-1880-426d-8eb9-a315dd135c29

📥 Commits

Reviewing files that changed from the base of the PR and between b0e07ac and 9ea73be.

📒 Files selected for processing (1)
  • packages/dicomImageLoader/src/imageLoader/wadouri/loadImage.ts
💤 Files with no reviewable changes (1)
  • packages/dicomImageLoader/src/imageLoader/wadouri/loadImage.ts

📝 Walkthrough

Walkthrough

The naturalized metadata loading path no longer emits diagnostic console.log calls or a compressed-frame warning. Existing metadata fallback behavior and error throwing remain unchanged.

Changes

WADO-URI logging cleanup

Layer / File(s) Summary
Remove diagnostic logging
packages/dicomImageLoader/src/imageLoader/wadouri/loadImage.ts
Removed diagnostic logs and the missing compressed-frame warning. NATURALIZED metadata lookup, fallback behavior, and error throwing remain unchanged.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 9ea73

This change removes logging from the DICOM image-loading path without introducing a documented behavior or production risk; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title describes configurable log levels, but the changes only remove diagnostic logging and a warning from the DICOM image loader. Update the title to describe removal of excessive logging from the DICOM image loader, using the required semantic-release format.
Description check ⚠️ Warning The description includes the required headings and issue link, but Changes & Results, Testing, checklist items, and tested environment details are incomplete. Describe the changes and testing steps, complete the checklist, and provide OS, Node version, and browser details.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes remove logging from the naturalized metadata loading path, which directly satisfies issue #2848.
Out of Scope Changes check ✅ Passed All reported changes remove logging from the targeted naturalized metadata loading path and remain within issue #2848 scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jbocce

jbocce commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

@daker is there a particular reason why you are removing these particular loggings?

@daker

daker commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

logging in a hot path can slowdown the rendering, those logs are unskipable

Comment thread packages/dicomImageLoader/src/imageLoader/wadouri/loadImage.ts
@daker daker changed the title fix(dicomImageLoader): remove logging feat(Core): set log level using config Aug 16, 2026
@daker

daker commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

@jbocce i replaced most of the console calls to logger and added a new config to let users toggle the logging

@daker
daker requested a review from jbocce August 16, 2026 12:19
@jbocce

jbocce commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

@jbocce i replaced most of the console calls to logger and added a new config to let users toggle the logging

Thanks. Although, I was really only expecting the one file to change 😃, but I think it is fine. @wayfarer3130 are you ok with these changes too?

@jbocce

jbocce commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Please check the failing unit tests.

@jbocce

jbocce commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

I'm not sure about the playwright test failures.

@daker

daker commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

@jbocce I fixed the tests, but I'm seeing the same Playwright test failures on other new PRs, so I don't think they're related to my code changes.

@jbocce

jbocce commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

@jbocce I fixed the tests, but I'm seeing the same Playwright test failures on other new PRs, so I don't think they're related to my code changes.

Yes, it looks like this example is broken and thus the related tests are also broken... https://www.cornerstonejs.org/live-examples/contourrenderingconfiguration.

@wayfarer3130

Copy link
Copy Markdown
Collaborator

Please update the description to actually match - this PR seems a lot mroe about moving console logs into loglevel logs so that they can be configured.
Hot path logs should be retained, but at a level at which they don't normally display - the time taken to run them when turned off should be sufficiently low that it doesn't interfere in all but the absolute critical paths - and usually those ones are better improved by optimizing them overall than by removing the log messages.

Comment thread packages/core/src/types/Cornerstone3DConfig.ts Outdated
Comment thread packages/core/src/types/Cornerstone3DConfig.ts Outdated

```ts
import { log } from '@cornerstonejs/core';

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.

This import doesn't work. @cornerstonejs/core never exports log - it's behind the utilities.logger namespace.

Use one of:

import { logging } from '@cornerstonejs/utils';
logging.log.getLogger('cs3d.dicomImageLoader.wadouri').setLevel('info');

or import { utilities } from '@cornerstonejs/core' and then utilities.logger.log.

Same line appears in the two snippets further down.


// One area
log.getLogger('cs3d.core.RenderingEngine').setLevel('debug');

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.

Please double check this, but I think this doesn't set the level for an area but instead only for the one logger named exactly cs3d.core.RenderingEngine.

dcmjs pins loglevel 1.9.2, which keeps every logger in one flat map (_loggersByName). Names with dots in them are just strings; there is no parent/child relationship. So cs3d.core.RenderingEngine.StackViewport stays at whatever level it had. Again double check this.

Only the root log.setLevel() reaches everything (it rebuilds all loggers that have no level of their own).

So either reword this to "one logger", and/or add an example that loops over log.getLoggers() and sets every name starting with the prefix.

## Logging

Cornerstone writes its messages with [loglevel](https://github.com/pmurias/loglevel),
through the same log root as dcmjs. Configure the logs with the loglevel

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.

Wrong repo - loglevel is at https://github.com/pimterry/loglevel.

import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';

const cs3dLogger = cornerstoneUtilities.logger.workerLog.getLogger(
'polymorphicSegmentation.workers.polySegConverters'

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.

workerLog is cs3d.worker, so this name comes out as cs3d.worker.polymorphicSegmentation.workers.polySegConverters.

worker isn't a package, so the package ends up in the third slot instead of the second, which doesn't match the cs3d.<PACKAGE>.<PATH>.<FILEORAREA> spec in the docs. Same in packages/tools/src/workers/computeWorker.js and packages/core/src/webWorkerManager/webWorkerManager.ts (which is core, not a worker package).

Suggestion: drop workerLog and use the package's own logger, so this becomes cs3d.polymorphicSegmentation.workers.polySegConverters. Being in a worker is already visible from the path.

import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';

const cs3dLogger = cornerstoneUtilities.logger.toolsLog.getLogger(
'polymorphicSegmentation.canComputeRequestedRepresentation'

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.

polymorphic-segmentation is its own package, but using toolsLog names it cs3d.tools.polymorphicSegmentation.*. Someone silencing cs3d.tools would silence this too.

Same in packages/labelmap-interpolation.

Suggestion: add polySegLog / labelmapInterpolationLog next to the other package loggers in packages/utils/src/utilities/logging/index.ts, and list both packages in the docs' <PACKAGE> examples.

import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';

const cs3dLogger = cornerstoneUtilities.logger.cs3dLog.getLogger('adapters.Cornerstone3D.MeasurementReport');

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.

The name is right, but adapters is the only package with no package logger - it uses cs3dLog and writes adapters. into the string by hand. Every other package has one (coreLog, toolsLog, ...).

Suggestion: add adaptersLog and use adaptersLog.getLogger('Cornerstone3D.MeasurementReport'), so the package prefix can't drift.

@zenna9

zenna9 commented Sep 2, 2026

Copy link
Copy Markdown

Thanks for working on this!

The current console spam is having a significant impact on the DX for applications using the library. I’m seeing several console logs per second during normal series loading, which can quickly result in hundreds of messages flooding the browser console.

The main issue for users is that these messages are emitted via console.log directly, so they cannot be disabled through the existing logger configuration.

I completely agree that standardizing the overall logging architecture is worth discussing, especially given the namespace issues raised in this PR. However, would it be possible to take a phased approach?

A minimal fix to suppress/remove the unskippable console.log calls would immediately unblock users experiencing this issue. The broader logger namespace refactoring could then be addressed separately in a follow-up PR.

This would allow us to solve the immediate user-facing problem without blocking the fix on the larger logging architecture discussion.

Thanks again to the author and maintainers for working through this!

@jbocce

jbocce commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

@daker just following up on this. I think there are review comments from Aug 20 I made that have not been addressed yet - I might be wrong. Are you planning on following up on these? I just don't want this PR that touches many files to go stale because of other commits and/or new files that might have come up since. If we could finish this up soon then that would be great. Thanks so much.

@daker

daker commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

@jbocce yes i will push the fixes

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.

[Feature Request] remove or guard extensive logging inside loadImageFromNaturalizedMetadata

4 participants