Noteworthy Placebo Mongers

    @jitesoft/yolog-json-plugin

    1.0.10 • Public • Published

    Yolog JSON Plugin

    npm (scoped) Known Vulnerabilities pipeline status coverage report npm Back project

    Plugin for the @jitesoft/yolog logger create logs in json format.
    When running in the browser, all the data will be printed to the console, while, when using the nodejs version the data can either be pushed to a file or to the stdout/stderr of the application.

    Usage:

    Install with your favorite package manager!

    npm i @jitesoft/yolog-json-plugin --save
    yarn add @jitesoft/yolog-json-plugin

    Import and use just as with any other yolog plugin!

    import logger from '@jitesoft/yolog';
    import JsonPlugin from '@jitesoft/yolog-json-plugin';
    logger.addPlugin(new JsonPlugin('file.txt'));

    To import it in a browser environment, the src/browser (or /dist/browser for precompiled) suffix have to be added:

    import logger from '@jitesoft/yolog';
    import JsonPlugin from '@jitesoft/yolog-json-plugin/src/browser';
    logger.addPlugin(new JsonPlugin()); // No file!

    Data format

    Each line in the output is a single JS Object notation, that is, the full file is not an array of json objects, but each line should be parsed as its own.

    Example:

    {"tag": "emergency", "timestamp": 123123123, "message": "abc123!!", "error":  { "message": "error message!", "stack": [ "callstack here." ] }}
    {"tag": "warning", "timestamp": 123123124, "message": "abc123"}

    That means that when parsing the file (or output), each line should be parsed as its own object.

    Install

    npm i @jitesoft/yolog-json-plugin

    DownloadsWeekly Downloads

    9

    Version

    1.0.10

    License

    MIT

    Unpacked Size

    112 kB

    Total Files

    10

    Last publish

    Collaborators

    • jitesoft~
    • johannestegner