@sap/logger-for-bas-extensions
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

styled with prettier Commitizen friendly

logger-for-bas-extensions

Logger Library For Business Application Studio Extensions.

This performs logging to the workspace container in SAP Business Application Studio in JSON format with the intent for the logs to be collected, saved, and processed by a separate service.

Installation

Enter the following command to install the library using npm install:

  • npm install @sap/logger-for-bas-extensions --save

Usage

Here is a sample of how to use the library:

import { getLogger, logLevelsKeys } from "@sap/logger-for-bas-extensions";

logger = await getLogger({
  level: logLevelsKeys.error,
  // Supply your package's name here.
  label: "<ExtensionName>",
  // Supply your package's version
  version: "1.2.3",
});

if (logger !== undefined) {
  // NOOP because the log level is `error` and `warn` < `error``
  logger.warn("oops I did it again!");

  logger.fatal("Oy Vey!");
  // -> {"label":"myLabel","version":"1.2.3","level":"fatal","message":"Oy Vey!","time":"2019-10-31T13:24:26.740Z"}

  // With Custom Payload Properties
  logger.fatal("Input size out of bounds!", { size: "10000000B" });
  // ->
  // {
  //   label: "myLabel",
  //   version: "1.2.3",
  //   level: "fatal",
  //   message: "Input size out of bounds!",
  //   size: "10000000B",
  //   time: "2019-10-31T13:24:26.740Z"
  // }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @sap/logger-for-bas-extensions

Weekly Downloads

0

Version

1.1.0

License

SAP

Unpacked Size

143 kB

Total Files

21

Last publish

Collaborators

  • sap_extncrepos