![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
logger-safe-security
Advanced tools
This package provides the logging configuration typically used in Safe Security.
Currently in Safe Security, all the services that require logging functionality imported a library & configured it as per the service needs. Although this seems okay initially, it becomes a challenge to do this across multiple services as care needs to be taken to keep the dependency versions consistent across, code reusability takes a back seat since the configuration is duplicated everywhere, and is prone to human errors.
In order to solve this problem, the winston
library used currently has been encapsulated in this package along with the desired defaults set up so that
the client does not have to worry about setting up a verbose configuration in multiple files.
npm install logger-safe-security
yarn add logger-safe-security
The introduction of this package makes it very easy for clients to consume & leverage the logging capabilities.
In Javascript:
const { createLogger } = require("logger-safe-security");
const logger = createLogger({ logLevel: "info" });
logger.info("Hello world!");
In Typescript:
import { createLogger } from "logger-safe-security";
const logger = createLogger({ logLevel: "info" });
logger.info("Hello world!");
Additionally, one can pass service
metadata while importing it within the context of a service. For example:
const { createLogger } = require("logger-safe-security");
const logger = createLogger({ service: "sample" });
logger.info("This log line will include service metadata");
The logger exported as part of this package contains the following definition:
JSON
. Hence, all the log messages will be represented (printed) as JSON objects.yyyy-MM-dd'T'HH:mm:ss.SSSZ
format.INFO
.Console
by default.Console
as well.{ "type" : "application" }
is added as default metadata to easily identify application logs. This can further be extended to differentiate
from audit logs and add parsing/filtering rules (for e.g. in Datadog) as needed.FAQs
Custom logging framework used in SAFE
The npm package logger-safe-security receives a total of 5,414 weekly downloads. As such, logger-safe-security popularity was classified as popular.
We found that logger-safe-security demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.