All files / platform/core/src logging.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 0/0
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39                                                  277x     277x     277x     277x     277x  
/**
 * OHIF loggers. They use the `loglevel` logging of `@cornerstonejs/utils`, so
 * OHIF, Cornerstone3D and dcmjs 1.x share one `loglevel` instance. The
 * default level of every logger is `warn`. To change all the loggers that have
 * no level of their own, call `rootLog.setLevel(level)` and then
 * `rootLog.rebuild()`. loglevel 1.x does not pass the root level to the other
 * loggers without `rebuild()`.
 *
 * A logger name has the structure `ohif.<PACKAGE>.<PATH>.<FILEORAREA>`, as the
 * `cs3d.*` loggers do. `<PACKAGE>` is the camel case package name without
 * `@ohif/`, for example `core`, `uiNext` or `extensionCornerstone`. Each OHIF
 * package exports its own logger, for example `coreLog` from `@ohif/core`.
 *
 * ```ts
 * const log = coreLog.getLogger('services', 'DisplaySetService');
 * ```
 *
 * To show the debug messages of the hanging protocols in the browser:
 * `localStorage['loglevel:ohif.core.services.HangingProtocolService'] = 'DEBUG'`,
 * then reload.
 */
import { logging } from '@cornerstonejs/utils';
 
export type { Logger } from '@cornerstonejs/utils';
 
export const { getRootLogger, getLogger } = logging;
 
/** The root of all the OHIF loggers. */
export const ohifLog = logging.getRootLogger('ohif');
 
/** The logger of `@ohif/core`. */
export const coreLog = ohifLog.getLogger('core');
 
/** The hanging protocol service, the protocol engine and the matchers. */
export const hpLog = coreLog.getLogger('services', 'HangingProtocolService');
 
/** The root `loglevel` logger, shared with Cornerstone3D and dcmjs. */
export const rootLog = logging.log;