How to use loglevelnext - 10 common examples

To help you get started, we’ve selected a few loglevelnext examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dcmjs-org / dcmjs / src / utilities / compression / rleSingleSamplePerPixel.js View on Github external
function decodeFrame(rleEncodedFrame, pixelData) {
    // Check HEADER:
    const header = new Uint32Array(rleEncodedFrame, 0, 16);

    if (header[0] !== 1) {
        log.error(
            `rleSingleSamplePerPixel only supports fragments with single Byte Segments (for rle encoded segmentation data) at the current time. This rleEncodedFrame has ${
                header[0]
            } Byte Segments.`
        );

        return;
    }

    if (header[1] !== 64) {
        log.error(
            "Data offset of Byte Segment 1 should be 64 bytes, this rle fragment is encoded incorrectly."
        );

        return;
    }
github dcmjs-org / dcmjs / src / DicomMetaDictionary.js View on Github external
if (entry) {
                let dataValue = dataset[naturalName];
                if (dataValue === undefined) {
                    // handle the case where it was deleted from the object but is in keys
                    return;
                }
                // process this one entry
                var dataItem = {
                    vr: entry.vr,
                    Value: dataset[naturalName]
                };
                if (entry.vr == "ox") {
                    if (dataset._vrMap && dataset._vrMap[naturalName]) {
                        dataItem.vr = dataset._vrMap[naturalName];
                    } else {
                        log.error(
                            "No value representation given for",
                            naturalName
                        );
                    }
                }

                dataItem.Value = DicomMetaDictionary.denaturalizeValue(
                    dataItem.Value
                );

                if (entry.vr == "SQ") {
                    var unnaturalValues = [];
                    for (
                        let datasetIndex = 0;
                        datasetIndex < dataItem.Value.length;
                        datasetIndex++
github dcmjs-org / dcmjs / src / utilities / compression / rleSingleSamplePerPixel.js View on Github external
function decodeFrame(rleEncodedFrame, pixelData) {
    // Check HEADER:
    const header = new Uint32Array(rleEncodedFrame, 0, 16);

    if (header[0] !== 1) {
        log.error(
            `rleSingleSamplePerPixel only supports fragments with single Byte Segments (for rle encoded segmentation data) at the current time. This rleEncodedFrame has ${
                header[0]
            } Byte Segments.`
        );

        return;
    }

    if (header[1] !== 64) {
        log.error(
            "Data offset of Byte Segment 1 should be 64 bytes, this rle fragment is encoded incorrectly."
        );

        return;
    }

    const uInt8Frame = new Uint8Array(rleEncodedFrame, 64);

    let pixelDataIndex = 0;
    let i = 0;

    while (pixelDataIndex < pixelData.length) {
        const byteValue = uInt8Frame[i];

        if (byteValue === undefined) {
            break;
github dcmjs-org / dcmjs / src / normalizers.js View on Github external
normalizeMultiframe() {
        let ds = this.dataset;
        if (!ds.NumberOfFrames) {
            log.error("Missing number or frames not supported");
            return;
        }
        if (Number(ds.NumberOfFrames) === 1) {
            log.error(
                "Single frame instance of multiframe class not supported"
            );
            return;
        }
        if (!ds.PixelRepresentation) {
            // Required tag: guess signed
            ds.PixelRepresentation = 1;
        }
        if (!ds.StudyID || ds.StudyID === "") {
            // Required tag: fill in if needed
            ds.StudyID = "No Study ID";
        }

        let validLateralities = ["R", "L"];
        if (validLateralities.indexOf(ds.Laterality) === -1) {
            delete ds.Laterality;
github dcmjs-org / dcmjs / src / normalizers.js View on Github external
this.datasets.forEach(function(dataset) {
            let position = dataset.ImagePositionPatient.slice();
            let positionVector = ImageNormalizer.vec3Subtract(
                position,
                referencePosition
            );
            let distance = ImageNormalizer.vec3Dot(positionVector, scanAxis);
            distanceDatasetPairs.push([distance, dataset]);
        });
        distanceDatasetPairs.sort(function(a, b) {
            return b[0] - a[0];
        });

        // assign array buffers
        if (ds.BitsAllocated !== 16) {
            log.error(
                "Only works with 16 bit data, not " +
                    String(this.dataset.BitsAllocated)
            );
        }
        if (referenceDataset._vrMap && !referenceDataset._vrMap.PixelData) {
            log.warn("No vr map given for pixel data, using OW");
            ds._vrMap = { PixelData: "OW" };
        } else {
            ds._vrMap = { PixelData: referenceDataset._vrMap.PixelData };
        }
        let frameSize = referenceDataset.PixelData.byteLength;
        ds.PixelData = new ArrayBuffer(ds.NumberOfFrames * frameSize);
        let frame = 0;
        distanceDatasetPairs.forEach(function(pair) {
            let dataset = pair[1];
            let pixels = new Uint16Array(dataset.PixelData);
github dcmjs-org / dcmjs / src / normalizers.js View on Github external
let distance = ImageNormalizer.vec3Dot(positionVector, scanAxis);
            distanceDatasetPairs.push([distance, dataset]);
        });
        distanceDatasetPairs.sort(function(a, b) {
            return b[0] - a[0];
        });

        // assign array buffers
        if (ds.BitsAllocated !== 16) {
            log.error(
                "Only works with 16 bit data, not " +
                    String(this.dataset.BitsAllocated)
            );
        }
        if (referenceDataset._vrMap && !referenceDataset._vrMap.PixelData) {
            log.warn("No vr map given for pixel data, using OW");
            ds._vrMap = { PixelData: "OW" };
        } else {
            ds._vrMap = { PixelData: referenceDataset._vrMap.PixelData };
        }
        let frameSize = referenceDataset.PixelData.byteLength;
        ds.PixelData = new ArrayBuffer(ds.NumberOfFrames * frameSize);
        let frame = 0;
        distanceDatasetPairs.forEach(function(pair) {
            let dataset = pair[1];
            let pixels = new Uint16Array(dataset.PixelData);
            let frameView = new Uint16Array(
                ds.PixelData,
                frame * frameSize,
                frameSize / 2
            );
            try {
github shellscape / webpack-plugin-serve / lib / log.js View on Github external
const symbol = ['error', 'warn'].includes(level) ? symbols.whoops : symbols.ok;
      return chalk[color](`${symbol} wps: `);
    },
    template: '{{level}}'
  };

  /* istanbul ignore if */
  if (options.timestamp) {
    prefix.template = `[{{time}}] ${prefix.template}`;
  }

  /* eslint-disable no-param-reassign */
  options.prefix = prefix;
  options.name = 'webpack-plugin-serve';

  const log = loglevel.create(options);

  return log;
};
github shellscape / webpack-plugin-serve / framework / log.js View on Github external
const color = colors[level];
      const symbol = ['error', 'warn'].includes(level) ? symbols.whoops : symbols.ok;
      return chalk[color](`${symbol} ${logName}: `);
    },
    template: '{{level}}'
  };

  if (options.timestamp) {
    prefix.template = `[{{time}}] ${prefix.template}`;
  }

  /* eslint-disable no-param-reassign */
  options.prefix = prefix;
  options.name = logName;

  const log = loglevel.create(options);

  return log;
};
github dcmjs-org / dcmjs / src / bitArray.js View on Github external
function pack(pixelData) {
    const numPixels = pixelData.length;

    log.log("numPixels: " + numPixels);

    const length = getBytesForBinaryFrame(numPixels);
    //log.log('getBytesForBinaryFrame: ' + length);

    const bitPixelData = new Uint8Array(length);

    let bytePos = 0;

    for (let i = 0; i < numPixels; i++) {
        // Compute byte position
        bytePos = Math.floor(i / 8);

        const pixValue = pixelData[i] !== 0;

        //log.log('i: ' + i);
        //log.log('pixValue: ' + pixValue);
github webpack-contrib / webpack-log / src / index.js View on Github external
return log;
}

module.exports = log;
// NOTE: this is exported so that consumers of webpack-log can use the same
// version of ansi-colors to decorate log messages without incurring additional
// dependency overhead
module.exports.colors = colors;
// NOTE: This is an undocumented function solely for the purpose of tests.
// Do not use this method in production code. Using in production code
// may result in strange behavior.
module.exports.delLogger = function delLogger(name) {
  delete loglevel.loggers[name];
};

module.exports.factories = loglevel.factories;

loglevelnext

A modern logging library for Node.js and modern browsers that provides log level mapping to the console

MPL-2.0
Latest version published 1 year ago

Package Health Score

56 / 100
Full package analysis