Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

log-buffer

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

log-buffer - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

tests/function-prefix.js

5

index.js

@@ -10,2 +10,3 @@ if (console._LOG_BUFFER) return;

process.on('exit', flush);
// export the flush and patch functions

@@ -31,3 +32,3 @@ module.exports = patch;

*/
function patch(limit) {
function patch(limit, pre) {
limit = limit || 8192; // 8kb

@@ -40,2 +41,4 @@

var s = util.format.apply(this, arguments);
if (typeof pre === 'string') s = pre + s;
else if (typeof pre === 'function') s = pre() + s;

@@ -42,0 +45,0 @@ // calculate the new length

2

package.json
{
"name": "log-buffer",
"description": "Buffer calls to console.log, console.warn, etc. for high performance logging",
"version": "0.0.2",
"version": "0.0.3",
"author": "Dave Eddy <dave@daveeddy.com> (http://www.daveeddy.com)",

@@ -6,0 +6,0 @@ "contributors": [],

@@ -42,2 +42,16 @@ log-buffer

You can specify a function or string to prefix all log statements
```js
require('log-buffer')(4096, 'MyLog: ');
```
All log statements will be prepended `MyLog: ` when flushed.
``` js
require('log-buffer')(4096, function() { return new Date().toISOString() + ': '; });
```
All log statements will be prepended by `2013-04-27T04:37:24.703Z: ` for example
This module also exposes the `flush` function used to flush all buffers, so

@@ -44,0 +58,0 @@ if you would like you can manually invoke a flush.

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