New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@allnulled/console-hooker

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@allnulled/console-hooker

Hook console.log seamlessly.

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-71.43%
Maintainers
0
Weekly downloads
 
Created
Source

console-hooker

Hook console.log seamlessly. Node.js or browser.

Installation

npm i -s @allnulled/console-hooker

Importation

In node.js:

require("@allnulled/console-hooker");

In html:

<script src="node_modules/@allnulled/console-hooker/console-hooker.js"></script>

Usage

Once loaded the file, ConsoleHooker is available globally:

const {restore, original} = ConsoleHooker(function(...args) {
  original(args);
  const list = Array.from(args);
  require("fs").appendFileSync("log.txt", JSON.stringify(list) + "\n", "utf8");
});

console.log("hi!"); // log.txt contains now ["hi!"]
console.log("hi!"); // log.txt contains now ["hi!"]\n["hi!"]
console.log("hi!"); // log.txt contains now ["hi!"]\n["hi!"]\n["hi!"]

restore();

console.log("this is not appended");

Keywords

FAQs

Package last updated on 27 Dec 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc