
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@studiohyperdrive/logger
Advanced tools
SHD logging module: an abstraction on console.log for both frontend as backend (Node.js).
One logger to rule them all  🚀
Supports browser console and Node.js, configurable and MIT licensed
@studiohyperdrive/logger is a logging library that supports both the browser and Node.js by exporting different bundles for both targets.
Install through npm:
$ npm install @studiohyperdrive/logger
Install through yarn:
$ yarn add @studiohyperdrive/logger
For usage with the browser a UMD and ESModule bundle are exported. It provides a Logger class which is an abstraction on console.log based on high-console.
Create an instance of the logger and export it for usage in your application:
logger.js
import { Logger } from "@studiohyperdrive/logger";
export const logger = new Logger();
app.js
import { logger } from "./logger";
logger.debug("some debug message", { key: "value" });
logger.info("some info message", { key: "value" });
logger.success("some success message", { key: "value" });
logger.warn("some warn message", { key: "value" });
logger.error("some error message", { key: "value" });
Output
As documented in the typings, each method has several overloads:
logger.info("some info message", { key: "value" }); // Message and object
logger.info("some info message"); // Message
logger.info({ key: "value" }); // Object
logger.info("some info message", { key: "value" }, true); // Force a log when loglevel is disabled
When creating an instance of the Logger class configuration can be provided by passing an options object to the constructor.
import { Logger } from "@studiohyperdrive/logger";
export const logger = new Logger({
enabled: [
"error",
],
});
The default configuration is the following:
{
enabled: [ // Enabled loglevels
"debug",
"info",
"success",
"warn",
"error"
],
timestamp: true
}
For usage with Node.js a CommonJS bundle is exported. It provides a Logger class which is an abstraction on console.log based on signale.
Other features:
Create an instance of the logger and export it for usage in your application:
logger.js
const Logger = require("@studiohyperdrive/logger");
const logger = new Logger();
module.exports = logger;
app.js
const logger = require("./logger");
logger.debug("some debug message", { key: "value" });
logger.info("some info message", { key: "value" });
logger.cron("some cron message", { key: "value" });
logger.db("some db message", { key: "value" });
logger.success("some success message", { key: "value" });
logger.warn("some warn message", { key: "value" });
logger.error("some error message", { key: "value" });
Output
As documented in the typings, each method has several overloads:
logger.info("some info message", { key: "value" }); // Message and object
logger.info("some info message"); // Message
logger.info({ key: "value" }); // Object
logger.info("some info message", { key: "value" }, true); // Force a log when loglevel is disabled
When creating an instance of the Logger class configuration can be provided by passing an options object to the constructor.
const Logger = require("@studiohyperdrive/logger");
const logger = new Logger({
enabled: [
"error",
],
filesystem: {
enabled: true,
path: "logs",
},
});
module.exports = logger;
The default configuration is the following:
{
enabled: [ // Enabled loglevels
"debug",
"info",
"cron",
"db",
"success",
"warn",
"error"
],
filesystem: {
enabled: true, // Enable logging to filesystem
path: "logs" // Path for the filesystem logs (from root)
},
timestamp: true,
}
Snippets for JavaScript and TypeScript can be found in the snippets folder.
We are continuously looking to improve this package. If you have any feedback or ideas, please let us know.
The roadmap as is today:
Feel free to provide feedback, open issues or create pull-requests to this repository.
@studiohyperdrive/logger is MIT licensed by Studio Hyperdrive.
Studio Hyperdrive is an experienced digital development studio focussed on all things JavaScript. Already 18 strong. Based in Antwerp & Ghent! With a handpicked set of skills we build anything from websites to chatbots and immersive cross reality experiences. Feel free to contact us through our website.
FAQs
SHD logging module: an abstraction on console.log for both frontend as backend (Node.js).
We found that @studiohyperdrive/logger demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 17 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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.