Skip to content

Commit

Permalink
fix: PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wayfarer3130 committed Mar 4, 2025
1 parent c6c7f2a commit dd6fcad
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/RenderingEngine/StackViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ interface SetVOIOptions {
voiUpdatedWithSetProperties?: boolean;
}

const log = coreLog.getLogger('StackViewport');
const log = coreLog.getLogger('RenderingEngine', 'StackViewport');

/**
* An object representing a single stack viewport, which is a camera
Expand Down
52 changes: 49 additions & 3 deletions packages/core/src/utilities/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,59 @@ export function getLogger(...name: string[]): Logger {
return getRootLogger(name.join('.'));
}

/** Pre-setup cateogires for easy logging, by package name */
/** Pre-setup categories for easy logging, by package name */
/**
* The cs3dLog is a root category for Cornerstone3D logs. In forms a grouping
* for the logs underneath it, although at this point the log levels are entirely
* either local or inherited from the root loglevel.
* In loglevel 2.0, the default log levels will inherit from the parent logger, so
* that using `cs3dLog.setLevel("info")` for example, will set child categories
* to level info unless they have been otherwise specified.
*
* As well, the categories could be used with an externally defined appender
* to separate various logs by source. See dicom issue log below.
*/
export const cs3dLog = getRootLogger('cs3d');

/**
* The core, tools etc logs are intended to form root categories for the various
* packages to allow a particular package to be debugged or output redirected.
*
* The recommended usage is to create a sub-logger at the file level to log
* data for a particular area such as:
* ```
* const log = coreLog.getLogger('RenderingEngine', 'StackViewport');
* ```
* This usage is intended to allow hierarchical categories to turn on an entire
* sub-directory of loggers such as `RenderingEngine` once hierarchical categories
* have been enabled in loglevel 2.0
*/
export const coreLog = cs3dLog.getLogger('core');
export const toolsLog = cs3dLog.getLogger('tools');
export const loaderLog = cs3dLog.getLogger('dicomImageLoader');
export const aiLog = cs3dLog.getLogger('ai');

/**
* The examples log is intended as a cross-package root logger for the examples,
* allowing separation of logging for examples from that for other areas.
*/
export const examplesLog = cs3dLog.getLogger('examples');

/** Dicom issue log is for reporting inconsistencies and issues with DICOM logging */
export const dicomIssueLog = getLogger('dicom', 'issue');
/**
* Dicom issue log is for reporting inconsistencies and issues with DICOM logging
* This log is separated from the cs3d hierarchy to allow separation of logs
* by use of an external appender to store inconsistencies and invalid DICOM
* values separately.
*
* Levels:
* * error - this is an issue in the data which prevents displaying at all
* * warn - a serious issue in the data which could cause significant display
* issues or mismatches of data.
* * info - an issue in the data which is handled internally or worked around such
* as not having patient name separated by `^` characters.
* * debug - an issue in the data which is common and is easily managed
*/
export const dicomConsistencyLog = getLogger('consistency', 'dicom');

/** An image consistency/issue log for reporting image decompression issues */
export const imageConsistencyLog = getLogger('consistency', 'image');

0 comments on commit dd6fcad

Please sign in to comment.