@genesislcap/foundation-logger
TypeScript icon, indicating that this package has built-in type declarations

14.209.0 • Public • Published

Genesis Foundation Logger

lerna TypeScript

foundation-logger provides a logging utility that currently wraps version 2 of consola.

Installation

To enable this module in your application, follow the steps below.

  1. Add @genesislcap/foundation-logger as a dependency in your package.json file. Whenever you change the dependencies of your project, ensure you run the $ npm run bootstrap command again. You can find more information in the package.json basics page.
{
  ...
  "dependencies": {
    ...
    "@genesislcap/foundation-logger": "latest"
    ...
  },
  ...
}
  1. Create a logger in my-package/utils/logger.ts for example.
import { createLogger } from '@genesislcap/foundation-logger';
export const logger = createLogger('my-package');

The logger will be set to LogLevel.Debug by default, however you can pass options as the second parameter to tailor this.

export const logger = createLogger('my-package', { level: LogLevel.Debug, ... });

LoggerOptions type extends the ConsolaOptions type.

  1. Use the logger in your package.
import { logger } from '../utils';
...
logger.debug('Checks complete');
  1. Explicitly set the log level of an imported foundation package when needed.
import { logger as commsLogger } from '@genesislcap/foundation-comms';
import { logger as storeLogger } from '@genesislcap/foundation-store';
import { LogLevel } from '@genesislcap/foundation-logger';
commsLogger.level = LogLevel.Warn;
storeLogger.level = LogLevel.Silent;

License

Note: this project provides front-end dependencies and uses licensed components listed in the next section; thus, licenses for those components are required during development. Contact Genesis Global for more details.

Licensed components

Genesis low-code platform

/@genesislcap/foundation-logger/

    Package Sidebar

    Install

    npm i @genesislcap/foundation-logger

    Weekly Downloads

    3,321

    Version

    14.209.0

    License

    SEE LICENSE IN license.txt

    Unpacked Size

    41.1 kB

    Total Files

    20

    Last publish

    Collaborators

    • genesisnpm